title: doctrine querybuilder $qb -> expr()-> all
body: <p>I'm working with Symfony2. I have to list last $nbOpe entities of Entity OpeEntetes. The following script gives me error:</p>
  
  <blockquote>
    <p>Blockquote</p>
  </blockquote>
  
  <p>[Doctrine\ORM\Query\QueryException]
    [Semantical Error] line 0, col 16 near 'ALL(SELECT FROM': Error: Class 'ALL' is not defined.</p>
  
  <blockquote>
    <p>Blockquote</p>
  </blockquote>
  
  <p>What to do ?</p>
  
  <pre><code>public function essai1($nbOpe){
          $in = $this-&gt;_em-&gt;createQueryBuilder()
              -&gt;from('GcRequetesBundle:OpeEntetes','ein')
              -&gt;orderBy('ein.oeNumOpe', 'DESC')
              -&gt;setMaxResults($nbOpe);
  
  $qb = $this-&gt;_em-&gt;createQueryBuilder();
              $qb
                  -&gt; add("select",new Expr\Select(array('res')))
                  -&gt; add('from', new Expr\From($qb -&gt; expr()-&gt; all($in -&gt; getDql()), 'res'));
              $query = $qb -&gt; getQuery();
              $result= $query -&gt; getArrayResult();
              return $result;
          }
  </code></pre>