mhndev / doctrine-repository by majidphpdeveloper

doctrine repository with simple queries inspired by eloquent
34
7
1
Package Data
Maintainer Username: majidphpdeveloper
Maintainer Contact: majid8911303@gmail.com (Majid Abdolhosseini)
Package Create Date: 2016-06-16
Package Last Update: 2016-09-25
Home Page:
Language: PHP
License: BSD Style
Last Refreshed: 2024-12-15 03:03:48
Package Statistics
Total Downloads: 34
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 7
Total Watchers: 1
Total Forks: 1
Total Open Issues: 0

Abstract Doctrine Repository

this package is for whom suffer from working with doctrine like me. for whom to like working with Eloquent ORM.

this package's intention is to help you to enjoy working with models and repositories and query the database as easy as possible.

sample usage :

every repository should extend

mhndev\doctrineRepository\AbstractDoctrineRepository

instead of

Doctrine\ORM\EntityRepository

so my UserRepository should look like :


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.


      $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();