How to do left join in Doctrine?
If you have an association on a property pointing to the user (let’s say Credit\Entity\UserCreditHistory#user, picked from your example), then the syntax is quite simple: public function getHistory($users) { $qb = $this->entityManager->createQueryBuilder(); $qb ->select(‘a’, ‘u’) ->from(‘Credit\Entity\UserCreditHistory’, ‘a’) ->leftJoin(‘a.user’, ‘u’) ->where(‘u = :user’) ->setParameter(‘user’, $users) ->orderBy(‘a.created_at’, ‘DESC’); return $qb->getQuery()->getResult(); } Since you are applying a condition … Read more