library doctrine-repository
doctrine repository with simple queries inspired by eloquent
mhndev/doctrine-repository
doctrine repository with simple queries inspired by eloquent
- Sunday, September 25, 2016
- by majidphpdeveloper
- Repository
- 1 Watchers
- 6 Stars
- 28 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 1 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
Abstract Doctrine Repository
this package is for whom suffer from working with doctrine like me.
for whom to like working with Eloquent ORM., (*1)
this package's intention is to help you to enjoy working with models and repositories and query the database as easy as possible., (*2)
sample usage :
every repository should extend, (*3)
mhndev\doctrineRepository\AbstractDoctrineRepository
```
instead of
```
Doctrine\ORM\EntityRepository
```
so my UserRepository should look like :
```php
namespace UserBundle\Repository;
use mhndev\doctrineRepository\AbstractDoctrineRepository;
/**
* UserRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class UserRepository extends AbstractDoctrineRepository
{
}
```
for example in your action controller you can do the following.
consider that here I have my UserRepository as an dependency in my UserController.
```php
$userArray = $this->repository->findOneById(1, false);
$userObject = $this->repository->findOneById(1);
$users = $this->repository->where('name','ab', 'like')->where('enable', 1)->whereIn('status',['public','private'])->all();
dev-develop
dev-develop
doctrine repository with simple queries inspired by eloquent
Sources
Download
MIT
The Requires
orm
laravel
repository
eloquent
doctrine
symfony