title: count total rows returned by query in doctrine 2 zf2
body: <pre><code>$countQuery = $qb-&gt;select('q.id,d.name,d.numbers')
              -&gt;from('Application\Entity\quests', 'q');
              -&gt;leftJoin('q.dots', 'd');
  $query1 = $countQuery-&gt;getQuery()-&gt;getResult();
  </code></pre>
  
  <p>now how would i get the total number of results returned 
  <code>**i don't want to write 2 queries**</code> bcz it will increase the execution time than
  i have tried</p>
  
  <pre><code> $countQuery = $qb-&gt;select('count(q.id) as total_results,d.name,d.numbers')
              -&gt;from('Application\Entity\quests', 'q');
              -&gt;leftJoin('q.dots', 'd');
  $query1 = $countQuery-&gt;getQuery()-&gt;getResult();
  </code></pre>
  
  <p>but its not working</p>