New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

mhndev/doctrine-repository

doctrine repository with simple queries inspired by eloquent
34 7
Install
composer require mhndev/doctrine-repository:dev-develop
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

goodwix/doctrine-json-odm

JSON Object-Document Mapping bundle for Symfony and Doctrine

27,647 22
dittto/doctrine-entity-factories

Allows doctrine to pull entities from factories instead of just reflection

6,668 2
beberlei/doctrineextensions

A set of extensions to Doctrine 2 that add support for additional query function...

86,090,341 2,102
laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

5,825,795 837
ems/versatile

Extensions for Laravels Eloquent ORM

8,592 0