title: Doctrine2 Paginator
body: <p>Starting with version 2.2 Doctrine has <a href="http://readthedocs.org/docs/doctrine-orm/en/latest/tutorials/pagination.html" rel="noreferrer">Paginator</a>. There is only one example in the documentation:</p>
  
  <pre><code>&lt;?php
  use Doctrine\ORM\Tools\Pagination\Paginator;
  
  $dql = "SELECT p, c FROM BlogPost p JOIN p.comments c";
  $query = $entityManager-&gt;createQuery($dql)
                         -&gt;setFirstResult(0)
                         -&gt;setMaxResults(100);
  
  $paginator = new Paginator($query, $fetchJoin = true);
  
  $c = count($paginator);
  foreach ($paginator as $post) {
      echo $post-&gt;getHeadline() . "\n";
  }
  </code></pre>
  
  <p>There is nothing new in this class since the whole process described in the documentation can be done with <code>$query-&gt;getResult()</code>.</p>
  
  <p>I know there are some bundles about pagination but I don't want to install third party bundles for such trivial issues. On the other hand, I cannot find anything about pagination of doctrine2. There should be some useful methods of the class. Where can I find them? If there are not then what is the point of the whole class?</p>