I have the following problem in Symfony2 / Doctrine-Environment:
Class a is related to class b, however this relationship is not registered through ORM annotations or anything else, since the reference table is a variable. Therefore, I join as follows:
$query = $this->createQueryBuilder('a') ->select('a') ->addSelect('b') ->leftJoin('My\Bundle\EntityBundle\Entity\OtherClass','b',\Doctrine\ORM\Query\Expr\Join::WITH,'a.referenceId=b.id') ->getQuery()->getResult($hydrationMode);
As a result, the array now contains both objects a and b (sort of like
array('a1', 'b1', 'a2', 'b2', .... )
) I could filter it again, but I feel this is not the way to go. I tried different hydration modes, but that didnโt change anything.
Is there a way to get it back, so the association is saved?
By this I mean sth as the following:
array(array('a1', 'b1'), array('a2', 'b2'), ...)
?
source share