title: how to pass Object to ORM Paginator Using Doctrine 2 and ZF2
body: <p>i am unable to pass Doctrine Object to ORMPaginator function here is the snippet to my code</p>
  
  <pre><code>  Doctrine\ORM\Tools\Pagination\Paginator as ORMPaginator;..............
  
  if (count($SearchResults) &gt; 0)
      {
          $ORMPaginator = new ORMPaginator($SearchResults);
      }
      else
      {
          $ORMPaginator = new ORMPaginator($VouchersRepo-&gt;createQueryBuilder('vouchers'));
      }
  
      $Adapter = new DoctrineAdapter($ORMPaginator);
      $Paginator = new Paginator($Adapter);
      $Paginator-&gt;setDefaultItemCountPerPage(5);
      $page = (int) $this-&gt;params()-&gt;fromQuery('page', 1);
      $Paginator-&gt;setCurrentPageNumber($page);
  </code></pre>
  
  <p>clearly $ORMPaginator = new ORMPaginator('pass me DQL'); requires Query to generate Paginator. Now how to pass Doctrine object(non DQL object) to ORMPaginator i cant get through this?</p>