title: RIGHT JOIN doctrine
body: <p>Im trying to Right join in symfony. I tried as described here <a href="https://stackoverflow.com/questions/16588270/doctrine-2-outer-join-query">Doctrine 2 - Outer join query</a> and here <a href="https://stackoverflow.com/questions/9652895/symfony-using-outer-joins-with-doctrine-orm">Symfony - Using Outer Joins with Doctrine ORM</a> .</p>
  
  <pre><code>$query = $em-&gt;getRepository('AppBundle:raports')-&gt;createQueryBuilder('r')
              -&gt;select('r')
              -&gt;leftJoin('r.requestRaports rr WITH rr.formId = :formId', false)
              -&gt;setParameter('formId', $requestId-&gt;getFormId())
              -&gt;getQuery();
  </code></pre>
  
  <p>it gives </p>
  
  <pre><code> SELECT 
    r0_.id AS id_0, 
    r0_.adminComment AS adminComment_1, 
    r0_.addDate AS addDate_2, 
    r0_.submitDate AS submitDate_3, 
    r0_.statusId AS statusId_4, 
    r0_.userId AS userId_5, 
    r0_.requestId AS requestId_6, 
    r0_.requestRaports AS requestRaports_7 
  FROM 
    raports r0_ 
    LEFT JOIN request_raports r1_ ON r0_.requestRaports = r1_.id 
    AND (r1_.formId = ?)
  </code></pre>
  
  <p>When i try </p>
  
  <pre><code>$query = $em-&gt;getRepository('AppBundle:raports')-&gt;createQueryBuilder('r')
              -&gt;select('r')
              -&gt;join('r.requestRaports rr WITH rr.formId = :formId', false)
              -&gt;setParameter('formId', $requestId-&gt;getFormId())
              -&gt;getQuery();
  </code></pre>
  
  <p>it looks like that</p>
  
  <pre><code>SELECT 
    r0_.id AS id_0, 
    r0_.adminComment AS adminComment_1, 
    r0_.addDate AS addDate_2, 
    r0_.submitDate AS submitDate_3, 
    r0_.statusId AS statusId_4, 
    r0_.userId AS userId_5, 
    r0_.requestId AS requestId_6, 
    r0_.requestRaports AS requestRaports_7 
  FROM 
    raports r0_ 
    INNER JOIN request_raports r1_ ON r0_.requestRaports = r1_.id 
    AND (r1_.formId = ?)
  </code></pre>
  
  <p>But i want query like </p>
  
  <blockquote>
    <p>SELECT * FROM <code>raports</code> r RIGHT JOIN request_raports rr ON
    r.<code>requestRaports</code> = rr.id</p>
  </blockquote>
  
  <p>How to make right join work in doctrine2?</p>