title: doctrine2 order by array with ids
body: <p>How I can with doctrine2 order by array with ids ?</p>
  
  <p>I have this query:</p>
  
  <pre><code>$qb = $this-&gt;createQueryBuilder('u')
          -&gt;select('u', 'n', 'c')
          -&gt;leftJoin('u.notifications', 'n')
          -&gt;leftJoin('u.channel', 'c')
          -&gt;andWhere('u.id IN (:ids)')
          -&gt;setParameter('ids', $ids);
  </code></pre>
  
  <p>I want that the result has the same order that array with ids, is possible do it ?</p>
  
  <p>Thanks</p>
  
  <p><strong>SOLUTION:</strong></p>
  
  <p>Use FIELD mysql extension with <a href="https://github.com/beberlei/DoctrineExtensions" rel="noreferrer">https://github.com/beberlei/DoctrineExtensions</a></p>
  
  <p>:)</p>
  
  <p>Thanks</p>