mhndev/doctrine-repository

doctrine repository with simple queries inspired by eloquent
34 7
Install
composer require mhndev/doctrine-repository
PHP:>=5.4.0
License:BSD Style
Last Updated:Sep 25, 2016
Links: GitHub  ·  Packagist
Maintainer: majidphpdeveloper

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

Related Packages

dittto/doctrine-entity-factories

Allows doctrine to pull entities from factories instead of just reflection

6,370 3
laravel-doctrine/extensions

Doctrine extensions for Laravel

3,618,827 49
laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

5,573,888 840
laravel-doctrine/migrations

Doctrine Migrations for Laravel

2,913,809 78