Details
Description
/** * @Orm\Entity * @Orm\Table(name="tt_content") */ class Page { /** * @Orm\Id * @Orm\GeneratedValue * @Orm\Column(type="integer", name="id") */ protected $id; /** * @Orm\ManyToOne(targetEntity="Page", inversedBy="children") * @Orm\JoinColumn(name="pid", referencedColumnName="id") */ protected $parent; /** @Orm\OneToMany(targetEntity="Page", mappedBy="parent") */ protected $children; /** @Orm\Column(name="page_title") */ protected $title; } $id = 5; // step 1 $page = $this ->getEntityManager('read') ->createQuery(' SELECT p, parent FROM OloloContentBundle:Page p LEFT JOIN p.parent parent WHERE p.id = :id ') ->setParameter('id', $id) ->getOneOrNullResult(); // step 2 $page = $this->getEntityManager('read')->find('OloloContentBundle:Page', $id); var_dump($page->getParent()->getParent()); // expected instance of Page, but got null
When I added one more fetch join for parent then I got Page.
Can you test against master again? I made a fix in context of
DDC-1452that i think could solve this issue.