symfony-bundle doctrine-repository
Generic admin bundle for Symfony2 from L'Arrière Guichet
lag/doctrine-repository
Generic admin bundle for Symfony2 from L'Arrière Guichet
- Tuesday, April 12, 2016
- by JohnKrovitch
- Repository
- 2 Watchers
- 1 Stars
- 675 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
, (*1)
DoctrineRepositoryBundle
Implementation of Repository pattern for Doctrine ORM, (*2)
Introduction
This bundle allows developpers to retrieve a Doctrine repository without passing by the EntityManager. Thoses repositories are exposed as service and constructed without using the Doctrine repository factory., (*3)
Example
- Define your repository class in your Doctrine entity as usual
/**
* Article
*
* @ORM\Table(name="article")
* @ORM\Entity(repositoryClass="MyVendor\MyBundle\Repository\ArticleRepository")
* @ORM\HasLifecycleCallbacks()
*/
class Article {
...
- Define the service with the tag "doctrine_repository"
my_repository:
class: MyVendor\MyBundle\Repository\ArticleRepository
tags:
- {name: doctrine.repository}
- Retrieve your repository from service container :
...
$this->get('my_repository');
...