/** * @return void */ public function initialize() { $this->criteria = $this->getVariable('validCriteria', []); $this->currentPage = isset($this->criteria['page']) ? $this->criteria['page'] : 1; $this->itemsCountPerPage = isset($this->criteria['limit']) ? $this->criteria['limit'] : 20; $criteria = $this->repository->createCriteria($this->criteria); $this->count = $this->repository->count($criteria); $this->zendPaginator = new ZendPaginator(new NullFill($this->count)); $this->zendPaginator->setCurrentPageNumber($this->currentPage); $this->zendPaginator->setDefaultItemCountPerPage($this->itemsCountPerPage); $this->zendPaginator->setPageRange(5); }
/** * @param mixed $criteria * @return int */ public function count($criteria) { return $this->entityRepository->count($criteria); }