When I wrote:
JavaScript
x
$query = $this->employeeRepository->createQueryBuilder('e')
->leftJoin('e.department', 'd')
;
return $query->getQuery()->getResult();
I expected to get the related eagerly but got Proxy instead.
Is there a way to force Doctrine to that relation eagerly without modifying the annotations
?
Advertisement
Answer
You need to select the value too, like:
JavaScript
$query = $this->employeeRepository->createQueryBuilder('e')
->select("e", "d")
->leftJoin('e.department', 'd')
;