Reputation: 59
I'm trying to make a DQL query, which keeps giving me this error:
[Semantical Error] line 0, col 68 near 'r': Error: Class Custom\SystemBundle\Entity\Element has no association named CustomAuthBundle:Role
The code for these Entities look like this:
Role:
/**
* @ORM\ManyToMany(targetEntity="Custom\SystemBundle\Entity\Element", mappedBy="role_id")
*/
private $element_id;
Element:
/**
* @ORM\ManyToMany(targetEntity="Custom\AuthBundle\Entity\Role", inversedBy="element_id")
*/
private $role_id;
And here is the query:
php app/console doctrine:query:dql 'SELECT e FROM CustomSystemBundle:Element e JOIN e.CustomAuthBundle:Role r'
Upvotes: 0
Views: 1219
Reputation: 44376
role_id
or element_id
. Objects will be stored there, not their identifiers. So abc_id
→ abc
.Assocations are defined by properties, not classnames:
[…] JOIN e.role r […]
Upvotes: 2