0
我想知道如何扩展自定义存储库并在教义中从教义实体管理器调用扩展存储库。学说如何扩展自定义存储库并从教义实体管理器调用扩展存储库
我的实体类:
/**
* @ORM\Entity(repositoryClass="Vendor\MyBundle\Repository\MyEntityRepository")
*/
class MyEntity
{
...
我的实体存储库类:
class MyEntityRepository extends EntityRepository
{
...
我的扩展库类:
:class MyExtendedEntityRepository extends MyEntityRepository
{
...
MyEntityRepository召唤10
调用MyExtendedEntityRepository?
class MyOtherEntityManager
{
protected $emr;
/**
*
* @return MyExtendedEntityRepository
*/
public function getRepository()
{
//This is what i want to know: How to access to the extended repository?
}
...
感谢
它的工作原理!用例是如果一个可选择的bundle被启用,它必须使得特定的查询重用所需bundle的扩展存储库方法。使用此解决方案时,无需在可选捆绑包启用时手动添加特征。 – Tsounabe