lag / doctrine-repository
Generic admin bundle for Symfony2 from L'Arrière Guichet
Installs: 681
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.4
- doctrine/doctrine-bundle: ~1.2
- doctrine/orm: ~2.5
- symfony/dependency-injection: ~2.6|~3.0
Requires (Dev)
- phpunit/phpunit: 4.7.*
This package is auto-updated.
Last update: 2024-11-21 20:02:03 UTC
README
DoctrineRepositoryBundle
Implementation of Repository pattern for Doctrine ORM
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.
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'); ...