我正在尝试进行 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'