Skip to content

ra3oul/doctrine-repository

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%