SimpleQuery: Remove deprecated method `paginate()`

This commit is contained in:
Sukhwinder Dhillon 2022-05-02 15:52:36 +02:00 committed by Johannes Meyer
parent 8f0ac0492d
commit b47298fffe
1 changed files with 0 additions and 40 deletions

View File

@ -5,13 +5,10 @@ namespace Icinga\Data;
use Iterator;
use IteratorAggregate;
use Zend_Paginator;
use Icinga\Application\Icinga;
use Icinga\Application\Benchmark;
use Icinga\Data\Filter\Filter;
use Icinga\Exception\IcingaException;
use Icinga\Exception\ProgrammingError;
use Icinga\Web\Paginator\Adapter\QueryAdapter;
class SimpleQuery implements QueryInterface, Queryable, Iterator
{
@ -517,43 +514,6 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator
return $this->limitOffset;
}
/**
* Paginate data
*
* Auto-detects pagination parameters from request when unset
*
* @param int $itemsPerPage Number of items per page
* @param int $pageNumber Current page number
*
* @return Zend_Paginator
*
* @deprecated Use Icinga\Web\Controller::setupPaginationControl() and/or Icinga\Web\Widget\Paginator instead
*/
public function paginate($itemsPerPage = null, $pageNumber = null)
{
trigger_error(
'SimpleQuery::paginate() is deprecated. Use Icinga\Web\Controller::setupPaginationControl()'
. ' and/or Icinga\Web\Widget\Paginator instead',
E_USER_DEPRECATED
);
if ($itemsPerPage === null || $pageNumber === null) {
// Detect parameters from request
$request = Icinga::app()->getRequest();
if ($itemsPerPage === null) {
$itemsPerPage = $request->getParam('limit', 25);
}
if ($pageNumber === null) {
$pageNumber = $request->getParam('page', 0);
}
}
$this->limit($itemsPerPage, $pageNumber * $itemsPerPage);
$paginator = new Zend_Paginator(new QueryAdapter($this));
$paginator->setItemCountPerPage($itemsPerPage);
$paginator->setCurrentPageNumber($pageNumber);
return $paginator;
}
/**
* Retrieve an array containing all rows of the result set
*