lag / doctrine-repository
L'Arrière Guichet 公司为 Symfony2 开发的通用管理包
dev-master
2016-04-11 22:18 UTC
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-09-21 19:41:43 UTC
README
DoctrineRepositoryBundle
Doctrine ORM 的仓库模式实现
简介
此包允许开发者在不过滤通过 EntityManager 的情况下检索 Doctrine 仓库。这些仓库作为服务暴露,并且在不使用 Doctrine 仓库工厂的情况下构建。
示例
- 如常在 Doctrine 实体中定义你的仓库类
/** * Article * * @ORM\Table(name="article") * @ORM\Entity(repositoryClass="MyVendor\MyBundle\Repository\ArticleRepository") * @ORM\HasLifecycleCallbacks() */ class Article { ...
- 使用标签 "doctrine_repository" 定义服务
my_repository: class: MyVendor\MyBundle\Repository\ArticleRepository tags: - {name: doctrine.repository}
- 从服务容器中检索您的仓库
... $this->get('my_repository'); ...