Kdyby\Doctrine\ResultSet::applyPaginator PHP Method

applyPaginator() public method

public applyPaginator ( Nette\Utils\Paginator $paginator, integer $itemsPerPage = NULL ) : ResultSet
$paginator Nette\Utils\Paginator
$itemsPerPage integer
return ResultSet
    public function applyPaginator(UIPaginator $paginator, $itemsPerPage = NULL)
    {
        if ($itemsPerPage !== NULL) {
            $paginator->setItemsPerPage($itemsPerPage);
        }
        $paginator->setItemCount($this->getTotalCount());
        $this->applyPaging($paginator->getOffset(), $paginator->getLength());
        return $this;
    }

Usage Example

示例#1
0
 public function render()
 {
     $template = $this->getTemplate();
     $template->setFile(__DIR__ . '/overview.latte');
     $this->resultSet->applyPaginator($this['vs']->getPaginator(), $this->pagesPerPage);
     $this->pages = $this->resultSet->toArray();
     $template->pages = $this->pages;
     $template->pagesCount = count($this->pages);
     $template->render();
 }
All Usage Examples Of Kdyby\Doctrine\ResultSet::applyPaginator