PHPackages                             fernandozueet/laravel-doctrine-repository - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. fernandozueet/laravel-doctrine-repository

ArchivedLibrary[Database &amp; ORM](/categories/database)

fernandozueet/laravel-doctrine-repository
=========================================

Complete repository model with laravel doctrine

1.4.2(7y ago)1116MITPHPPHP &gt;=7.2.0

Since Sep 4Pushed 7y ago1 watchersCompare

[ Source](https://github.com/FernandoZueet/laravel-doctrine-repository)[ Packagist](https://packagist.org/packages/fernandozueet/laravel-doctrine-repository)[ RSS](/packages/fernandozueet-laravel-doctrine-repository/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (8)Versions (5)Used By (0)

Laravel doctrine repository
===========================

[](#laravel-doctrine-repository)

Complete repository model with laravel doctrine.

Notices
-------

[](#notices)

The doctrine laravel library is used as the base of the repository class. [Documentation of lib laravel doctrine](https://laraveldoctrine.org/docs/1.3/orm)

Requirements
------------

[](#requirements)

- PHP 7.2
- Laravel 5.6 - [Documentation](https://laravel.com/docs/5.6)

Packages
--------

[](#packages)

- doctrine: 2.6 - [Documentation](https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/index.html)
- laravel-doctrine/orm: 1.4 - [Documentation](https://laraveldoctrine.org/docs/1.3/orm)
- beberlei/doctrineextensions: 1.1 - [Documentation](https://github.com/beberlei/DoctrineExtensions)
- symfony/property-access: 4.1 - [Documentation](https://symfony.com/doc/current/components/property_access.html)
- symfony/serializer: 4.1 - [Documentation](https://symfony.com/doc/current/serializer.html)
- syslogic/doctrine-json-functions: 2.0 - [Documentation](https://github.com/SyslogicNL/DoctrineJsonFunctions)

---

Documentation
-------------

[](#documentation)

- [Installation](#installation)
- [Step by step](#step-by-step)
- [Examples](#examples)
- [Using different database connections](#using-different-database-connections)
- [Instantiating the created repository](#instantiating-the-created-repository)
- [Entering Data (INSERT)](#entering-data-insert)
- [Update Data (UPDATE)](#update-data-update)
- [Update Query Data (UPDATE)](#update-query-data-update)
- [Delete Data (DELETE)](#delete-data-delete)
- [Select Data (SELECT)](#select-data-select)
- [Find by id](#find-by-id)
- [Transctions](#transctions)
- [Dql](#dql)
- [Where and having options](#where-and-having-options)
- [Order by options](#order-by-options)
- [Group by options](#group-by-options)
- [Extra functions](#extra-functions)

---

Installation
------------

[](#installation)

Install this package with composer:

```
composer require fernandozueet/laravel-doctrine-repository
```

After updating composer, add the ServiceProvider to the providers array in `config/app.php`

```
Ldr\Core\DoctrineRepositoryServiceProvider::class,
```

To publish the config use:

```
php artisan vendor:publish --tag="configRepository"
```

---

Step by step
------------

[](#step-by-step)

1- Configure your connection to the database `.env`

2- Configure extra doctrine information. `config/doctrine.php`

3- Generate the entities

```
php artisan make:doctrine-repository:entities
```

4- Generate repository file.

File will be created by default `app/Repositories` folder. You can change the folder in the `config/doctrine.php` file.

`ATTENTION!! use the same entity name`

```
php artisan make:doctrine-repository User
```

Create file inside a folder

```
php artisan make:doctrine-repository SubPath/User
```

---

Examples
--------

[](#examples)

### Example class repository

[](#example-class-repository)

file: `app/Repositories/User/UserDocRepository.php`

```
