Doctrine2, Error: Class has no association named children
-
$dql = "SELECT l, c FROM FakeBundle:Location l LEFT JOIN l.children c"; $query = $this->getEntityManager()->createQuery($dql);
But this request makes a mistake:
[Semantical Error] line 0, col 60 near 'c': Error: Class FakeBundle\Entity\Location has no association named children
♪ http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#one-to-many-self-referencing The same code as me:
/**
- @var Location
- @ORM\ManyToOne(targetEntity="Location", inversedBy="children")
- @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
private $parent;
/**
- @var ArrayCollection|Location[]
- @ORM\OneToMany(targetEntity="Location", mappedBy="parent")
*/
private $children;
What's the problem?
-
Problem solved! I just had to clean the cash.