title: Doctrine2 Paginator getting total results
body: <p>Right away I would say, that I read this question <a href="https://stackoverflow.com/questions/10106695/doctrine2-paginator">Doctrine2 Paginator</a>, but it doesn't give me enough information regarding the title of my question.</p>
  
  <p>When I used Doctrine1 I was getting the result with such code for example:</p>
  
  <pre><code>$list = $this-&gt;query
      -&gt;addSelect( 'SQL_CALC_FOUND_ROWS *' )
      -&gt;offset( ( $this-&gt;currentPage - 1 ) * $this-&gt;perPage )
      -&gt;limit( $this-&gt;perPage )
      -&gt;execute( array(), \Doctrine_Core::HYDRATE_ARRAY_SHALLOW );
  
  $totalRecords     = SqlCalcFoundRowsEventListener::getFoundRowsCount();
  $this-&gt;totalPages = ceil( $totalRecords / $this-&gt;perPage );
  </code></pre>
  
  <p>and it was great.</p>
  
  <p>Now, when using Doctrine2 I'm confused on how should I get total amount of records with same query as limited result for current page.</p>
  
  <p>Any help/advice would be greatly appreciated.</p>