Doctrine 1
  1. Doctrine 1
  2. DC-977

wrong offset in sfDoctrinePager

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor 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.

        Activity

        Hide
        Pavel Campr added a comment -

        sorry, this is not doctrine related issue, it's just symfony

        Show
        Pavel Campr added a comment - sorry, this is not doctrine related issue, it's just symfony

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Pavel Campr
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: