Download the PHP package fernandozueet/laravel-doctrine-repository without Composer
On this page you can find all versions of the php package fernandozueet/laravel-doctrine-repository. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fernandozueet/laravel-doctrine-repository
More information about fernandozueet/laravel-doctrine-repository
Files in fernandozueet/laravel-doctrine-repository
Package laravel-doctrine-repository
Short Description Complete repository model with laravel doctrine
License MIT
Informations about the package laravel-doctrine-repository
Laravel doctrine repository
Complete repository model with laravel doctrine.
Notices
The doctrine laravel library is used as the base of the repository class. Documentation of lib laravel doctrine
Requirements
- PHP 7.2
- Laravel 5.6 - Documentation
Packages
- doctrine: 2.6 - Documentation
- laravel-doctrine/orm: 1.4 - Documentation
- beberlei/doctrineextensions: 1.1 - Documentation
- symfony/property-access: 4.1 - Documentation
- symfony/serializer: 4.1 - Documentation
- syslogic/doctrine-json-functions: 2.0 - Documentation
Documentation
- Installation
- Step by step
- Examples
- Using different database connections
- Instantiating the created repository
- Entering Data (INSERT)
- Update Data (UPDATE)
- Update Query Data (UPDATE)
- Delete Data (DELETE)
- Select Data (SELECT)
- Find by id
- Transctions
- Dql
- Where and having options
- Order by options
- Group by options
- Extra functions
Installation
Install this package with composer:
After updating composer, add the ServiceProvider to the providers array in config/app.php
To publish the config use:
Step by step
1- Configure your connection to the database .env
2- Configure extra doctrine information. config/doctrine.php
3- Generate the 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
Create file inside a folder
Examples
Example class repository
file: app/Repositories/User/UserDocRepository.php
Example interface repository
file: app/Repositories/User/UserRepositoryInterface.php
Example class service provider
file: app/Providers/UserDocRepositoryServiceProvider.php
Using different database connections
Configure the new configuration in managers array the config/doctrine.php
file you may notice that the default connection name is default. Insert a new position in the array with the settings
Using the new connection in the repository:
file: app/Repositories/User/UserDocRepository.php
Instantiating the created repository
You can use the repository in your controller, service layer or wherever you want.
If you have created the repository with interface.
1 - Instantiating directly:
2 - Use controller:
if you have not created an interface.
1 - Instantiating directly:
2 - Use controller:
Entering Data (INSERT)
example table: id
, first_name
, lastName
, user_genre_id
, updated_at
, created_at
.
created_at
automatically inserted.
file: app/Repositories/User/UserDocRepository.php
Do not automatically inserted createdAt
Dealing with the object of return:
Execute function:
Update Data (UPDATE)
example table: id
, first_name
, lastName
, user_genre_id
, updated_at
, created_at
.
updated_at
automatically update.
ATTENTION!
To update more than one data, use the method updateQuery.
file: app/Repositories/User/UserDocRepository.php
Do not automatically update updatedAt
Dealing with the object of return:
Execute function:
Update Query Data (UPDATE)
example table: id
, first_name
, lastName
, user_genre_id
, updated_at
, created_at
.
updated_at
automatically update.
file: app/Repositories/User/UserDocRepository.php
Creating the condition for the update:
Execute function:
Delete Data (DELETE)
Creating the condition for the delete:
file: app/Repositories/User/UserDocRepository.php
Execute function:
Select Data (SELECT)
Select settings:
file: app/Repositories/User/UserDocRepository.php
Creating the condition for the select:
Creating the order by for the select:
Creating the group by for the select:
Creating the having for the select:
Execute function:
Find by id
Execute function:
Transctions
Execute function:
Dql
Creating query:
file: app/Repositories/User/UserDocRepository.php
Execute function:
Where and having options
These options are valid for where and having.
file: app/Repositories/User/UserDocRepository.php
Order by options
file: app/Repositories/User/UserDocRepository.php
Group by options
file: app/Repositories/User/UserDocRepository.php
Extra functions
file: app/Repositories/User/UserDocRepository.php
Contributing
Please see CONTRIBUTING for details.
Security
If you discover security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The PHP Upload and Image Manipulation is licensed under the MIT license. See License File for more information.
All versions of laravel-doctrine-repository with dependencies
laravel-doctrine/orm Version 1.4.*
beberlei/doctrineextensions Version ^1.1
symfony/property-access Version ^4.1
symfony/serializer Version ^4.1
scienta/doctrine-json-functions Version ~4.0