title: How to do left join in Doctrine?
body: <p>This is my function where I'm trying to show the User history. For this I need to display the user's current credits along with his credit history.</p>
  
  <p>This is what I am trying to do:</p>
  
  <pre><code> public function getHistory($users) {
      $qb = $this-&gt;entityManager-&gt;createQueryBuilder();
      $qb-&gt;select(array('a','u'))
              -&gt;from('Credit\Entity\UserCreditHistory', 'a')
              -&gt;leftJoin('User\Entity\User', 'u', \Doctrine\ORM\Query\Expr\Join::WITH, 'a.user = u.id')
              -&gt;where("a.user = $users ")
              -&gt;orderBy('a.created_at', 'DESC');
  
      $query = $qb-&gt;getQuery();
      $results = $query-&gt;getResult();
  
      return $results;
  }
  </code></pre>
  
  <p>However, I get this error :</p>
  
  <blockquote>
    <p>[Syntax Error] line 0, col 98: Error: Expected Doctrine\ORM\Query\Lexer::T_WITH, got 'ON'</p>
  </blockquote>
  
  <p><em>Edit</em>: I replaced 'ON' with 'WITH' in the join clause and now what I see is only 1 value from the joined column.</p>