Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Invalid
-
Affects Version/s: 1.2.3
-
Fix Version/s: None
-
Component/s: Pager
-
Labels:None
Description
as reported in symfony http://trac.symfony-project.org/ticket/8979
In sfDoctrinePager::init() the offset for the query is determined by the statement:
$offset = ($this->getPage() - 1) * $this->getMaxPerPage()
Immediately after that, the $this->lastPage value is set:
$this->setLastPage(ceil($this->getNbResults() / $this->getMaxPerPage()));
However, sfPager::setLastPage() corrects the page number ($this->page) in case $this->getPage() > $this->lastPage.
Thus, the calculation of the offset should happen after the $this->setLastPage(...) statement, because $this->getPage() is used.
The attached patch (in symfony trac) moves the $offset = ... below the $this->setLastPage(...) line.
sorry, this is not doctrine related issue, it's just symfony