8.4.2 How to use pagination?
Permalink
The old way of using pagination was with the ItemList's getPagination() which is now deprecated. It says "call the pagination factory directly". So I did - I used the function code:
but it says "Call to protected method createPaginationObject() from context" of the block controller.
What's wrong here?
$comments = new ItemList(); $comments->setItemsPerPage(10); $factory = new PaginationFactory(\Request::getInstance()); if (method_exists($comments, 'createPaginationObject')) { $paginator = $comments->createPaginationObject(); $paginator = $factory->deliverPaginationObject($comments, $paginator); } else { $paginator = $factory->createPaginationObject($comments); } $pagination = $paginator->renderDefaultView(); $this->set('comments', $paginator->getCurrentPageResults()); $this->set('pagination', $pagination); $this->set('paginator', $paginator);
but it says "Call to protected method createPaginationObject() from context" of the block controller.
What's wrong here?