Bug #95802
openPaginator does not respect initial limit or offset
0%
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!
Updated by Georg Ringer almost 3 years ago
- Subject changed from Paginator does not respect initial limit to Paginator does not respect initial limit or offset
Updated by Georg Ringer almost 3 years ago
Updated by Karel Kuijpers almost 3 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
Updated by Gerrit Code Review over 1 year 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
Updated by Gerrit Code Review over 1 year 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
Updated by Gerrit Code Review over 1 year 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
Updated by Gerrit Code Review over 1 year 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
Updated by Stefan Bürk over 1 year ago
- Related to Bug #94965: QueryResultPaginator override current limit/offset added
Updated by Georg Ringer 6 months ago
- Status changed from Under Review to Closed
closed in favor of #94965
Updated by Gerrit Code Review about 1 month ago
- Status changed from Closed to Under Review
Patch set 5 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