Symfony 2中的2级实体文件夹



我在Symfony2捆绑包中有一个两级实体文件夹:

CommonBundle/Entity/EntityFolder1/EntityA.php
CommonBundle/Entity/EntityFolder2
CommonBundle/Entity/EntityFolder3
CommonBundle/Entity/EntityFolder4

当我试图获取某个文件夹中实体的存储库时:

$product = $this->getDoctrine()->getRepository('CommonBundle:EntityA')->find(1); 

Symfony不认识这个CommonBundle:EntityA

我也试过CommonBundle:EntityFolder1:EntityA

警告:class_parents():class CommonBundle\Entity\EntityA没有存在并且无法加载到中

它是CommonBundle:EntityFolder1EntityA

使用实体的完整类名:

$product = $this->getDoctrine()
                ->getRepository('AcmeCommonBundleEntityEntityFolder1EntityA')
                ->find(1);

相关内容

  • 没有找到相关文章

最新更新