1
0
mirror of synced 2024-12-13 14:56:01 +03:00

Fixed _adjustOffset in order to get it working after previous change in Pager

This commit is contained in:
guilhermeblanco 2008-01-17 15:33:08 +00:00
parent 78edfd59a6
commit 99d026b894

View File

@ -107,9 +107,9 @@ class Doctrine_Pager
{
// retrieve the number of items found
$count = $this->getCountQuery()->count($this->getCountQueryParams($params));
$this->_setNumResults($count);
$this->_setExecuted(true);
$this->_setNumResults($count);
$this->_setExecuted(true); // _adjustOffset relies of _executed equals true = getNumResults()
$this->_adjustOffset();
}
@ -124,7 +124,6 @@ class Doctrine_Pager
*/
protected function _adjustOffset()
{
if (!$this->getExecuted()) {
// Define new total of pages
$this->_setLastPage(
max(1, ceil($this->getNumResults() / $this->getMaxPerPage()))
@ -136,7 +135,6 @@ class Doctrine_Pager
$p->offset($offset);
$p->limit($this->getMaxPerPage());
}
}
/**