public function createRepresentationFromPagerfanta(Pagerfanta $pager)
 {
     $this->pager = empty($pager) ? $this->pager : $pager;
     if (empty($this->pager)) {
         return array();
     }
     $representation = array('hasToPaginate' => $this->pager->haveToPaginate(), 'hasNextPage' => $this->pager->hasNextPage(), 'hasPreviousPage' => $this->pager->hasPreviousPage(), 'totalItems' => $this->pager->getNbResults(), 'itemsPerPage' => $this->pager->getMaxPerPage(), 'currentPage' => $this->pager->getCurrentPage(), 'data' => $this->pager->getCurrentPageResults());
     return $representation;
 }
 /**
  * @return boolean
  */
 public function haveToPaginate()
 {
     return $this->pagerfanta->haveToPaginate();
 }
Example #3
0
 public function testHaveToPaginateReturnsFalseWhenTheNumberOfResultsIsLessThanMaxPerPage()
 {
     $this->setAdapterNbResultsAny(100);
     $this->pagerfanta->setMaxPerPage(101);
     $this->assertFalse($this->pagerfanta->haveToPaginate());
 }