title: Left join ON condition AND other condition syntax in Doctrine
body: <p>I'm using Doctrine's querybuilder in Symfony2 to create a query to fetch entities.</p>
  
  <p>My current code looks like this:</p>
  
  <pre><code>$repository = $this-&gt;getDoctrine()-&gt;getRepository('AaaBundle:Application');
  
      $queryBuilder = $repository-&gt;createQueryBuilder('a');
      $queryBuilder
          -&gt;addSelect('u')
          -&gt;addSelect('i')
          -&gt;orderBy('a.created_date', 'DESC')
          -&gt;leftJoin('a.created_by', 'u')
          -&gt;leftJoin('a.installations', 'i')
          //-&gt;where('i.page = :page')
          //-&gt;setParameter('page', $found)
          ;
  </code></pre>
  
  <p>Now I can use this to get all the pages regardless of them having an installation or not.
  But I only want to join them it the <code>$found</code> page is available (so that if there is an installation for the app, but it's on another page, the installation wont be joined). If I unquote the where clause, it will show only apps that have an installation for the page. I want all apps with or without installations for the page.</p>
  
  <p>In SQL I can get this by adding <code>AND</code> to the join</p>
  
  <pre><code>LEFT JOIN installations i ON a.id = i.app AND i.page = :page
  </code></pre>
  
  <p>This way I get the installation info for an app that has an installation on the page, but I get null values on the columns for app's that have installations on other pages or not at all.</p>
  
  <p>Is there a way to do this in Doctrine or am I better off just getting all the installations for each application and then checking against the found page with php?</p>