I have written code in controller given below,
$iteratorAdapter = new \Zend\Paginator\Adapter\Iterator($this->getCategoryTable()->listCategoryData());
$paginatorDatas = new \Zend\Paginator\Paginator($iteratorAdapter);
$paginatorDatas->setCurrentPageNumber($page)->setItemCountPerPage(5);
and I render the variable $paginatorDatas to view file.
In the corresponding view file, I have written the code like this,
echo $this->paginationControl($this->paginatorDatas, 'Elastic', 'paginator.phtml');
Before calling $this->paginationControl() function I have iterated the array object($paginatorDatas), through foreach(){}
to populate records.
But the above code gives the following error,
Fatal error: Uncaught exception 'Zend\Db\Adapter\Exception\RuntimeException' with message 'This result is a forward only result set, calling rewind() after moving forward is not supported' in /var/www/cp/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Result.php:153 Stack trace: #0 [internal function]: Zend\Db\Adapter\Driver\Pdo\Result->rewind() #1 /var/www/cp/module/Admin/view/admin/category/ajax-list.phtml(21): LimitIterator->rewind() #2 /var/www/cp/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php(507): include('/var/www/cp/mod...') #3 /var/www/cp/vendor/zendframework/zendframework/library/Zend/View/View.php(205): Zend\View\Renderer\PhpRenderer->render(Object(Zend\View\Model\ViewModel)) #4 /var/www/cp/vendor/zendframework/zendframework/library/Zend/Mvc/View/Http/DefaultRenderingStrategy.php(102): Zend\View\View->render(Object(Zend\View\Model\ViewModel)) #5 [internal function]: Zend\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Zend\Mvc\MvcEvent)) #6 /var/www/cp/ in /var/www/cp/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Result.php on line 153
Please help me....