/** * {@inheritdoc} */ public function getViewData(DocumentIterator $result, ViewData $data) { /** @var ViewData\PagerAwareViewData $data */ $data->setPager(new PagerService(new CountAdapter($result->getTotalCount()), array_filter(['page' => $data->getState()->getValue(), 'limit' => $this->getCountPerPage(), 'max_pages' => $this->getMaxPages()]))); return $data; }