0
我試圖做一個DQL查詢,這一直給我這個錯誤:的Symfony2/Doctrine2多對多DQL「沒有協會命名」錯誤
[Semantical Error] line 0, col 68 near 'r': Error: Class Custom\SystemBundle\Entity\Element has no association named CustomAuthBundle:Role
這些實體的代碼如下所示:
角色:
/**
* @ORM\ManyToMany(targetEntity="Custom\SystemBundle\Entity\Element", mappedBy="role_id")
*/
private $element_id;
元素:
/**
* @ORM\ManyToMany(targetEntity="Custom\AuthBundle\Entity\Role", inversedBy="element_id")
*/
private $role_id;
這裏是查詢:
php app/console doctrine:query:dql 'SELECT e FROM CustomSystemBundle:Element e JOIN e.CustomAuthBundle:Role r'
是啊,我剛剛得到了一分鐘前。謝謝您的回答! – muchar