Project

General

Profile

Actions

Bug #95802

open

Paginator does not respect initial limit or offset

Added by Georg Ringer over 2 years ago. Updated 9 months ago.

Status:
Under Review
Priority:
Must have
Assignee:
-
Category:
-
Start date:
2021-10-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
On Location Sprint

Description

If the paginator is used with an initial limit, that must be respected as well.

Given 20 records and setting $query->setLimit(10) and having 5 items per page, only 2 pages must be shown, currently the limit is completly ignored!


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #94965: QueryResultPaginator override current limit/offsetUnder Review2021-08-23

Actions
Actions #1

Updated by Georg Ringer over 2 years ago

  • Subject changed from Paginator does not respect initial limit to Paginator does not respect initial limit or offset
Actions #3

Updated by Karel Kuijpers about 2 years ago

The problem is in TYPO3\CMS\Extbase\Pagination\QueryResultPaginator. It overrides the original offset within the query of the items to be paginated. The method updatePaginatedItems should be updated as follows:
protected function updatePaginatedItems(int $limit, int $offset): void {
$origOffset=$this->paginatedQueryResult = $this->queryResult
>getQuery()>getOffset();

$this->paginatedQueryResult = $this->queryResult
->getQuery()
->setLimit($limit)
->setOffset($origOffset+$offset)
->execute();
}

I have tested it and it works perfectly for offset and limit

Actions #4

Updated by Benni Mack 9 months ago

  • Sprint Focus set to On Location Sprint
Actions #5

Updated by Gerrit Code Review 9 months ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80326

Actions #6

Updated by Gerrit Code Review 9 months ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80326

Actions #7

Updated by Gerrit Code Review 9 months ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80326

Actions #8

Updated by Gerrit Code Review 9 months ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80326

Actions #9

Updated by Stefan Bürk 9 months ago

  • Related to Bug #94965: QueryResultPaginator override current limit/offset added
Actions

Also available in: Atom PDF