title: is it possible to integrate in a doctrine query a if statement?
body: <p>I have so far 2 queries which are similar:</p>
  
  <p>the first one I use when user is ROLE_REDAC</p>
  
  <pre><code>$qb = $this-&gt;createQueryBuilder('a');
      $qb-&gt;LeftJoin('a.ArticlePhrases','ap')
          -&gt;addSelect('ap')
          -&gt;where(
                  $qb-&gt;expr()-&gt;andX(
                      $qb-&gt;expr()-&gt;eq('ap.order', '?1'),
                      $qb-&gt;expr()-&gt;eq('a.author', '?2')
                      )
                  )
          -&gt;setParameters(//...
                         );
  </code></pre>
  
  <p>The second one when user is ROLE_ADMIN</p>
  
  <pre><code>$qb = $this-&gt;createQueryBuilder('a');
      $qb-&gt;LeftJoin('a.ArticlePhrases','ap')
          -&gt;addSelect('ap')
          -&gt;where(
                  $qb-&gt;expr()-&gt;andX(
                      $qb-&gt;expr()-&gt;eq('ap.order', '?1')
                      )
                  )
          -&gt;setParameters(...
                  ));
  </code></pre>
  
  <p>There are not much difference. is it possible to call from the controller the same repository fonction and that this fonction adapt whether the actual user is ROLE_REDAC or ROLE_ADM? if yes how can I do that?</p>