Project

General

Profile

Actions

Bug #88159

closed

PaginateController does not respect offset from original query

Added by Chris Müller over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2019-04-16
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I have an own find method instead of findAll() in a repository which I call from the action of a controller and set an offset in it (for example offset = 1). The paginate widget now renders the items on the first page correctly (e.g. items 2-5 when showing 4 items per page). The seconds page instead will show the items 5-8 instead of 6-9 (so item 5 is shown twice).

This is because the indexAction of the PaginateController does not respect the offset of the queryResult object.

Example for find method in repository class:

public function findAllExceptFirstEntry()
{
    $query = $this->createQuery();
    $query->setOffset(1);

    return $query->execute();
}

Example for usage of paginate widget:

<f:widget.paginate objects="{items}" as="paginatedItems" configuration="{itemsPerPage: 4, insertAbove: 0, insertBelow: 1}">
    <ul>
        <f:for each="{paginatedItems}" as="item">
            <li>{item.title}</li>
        </f:for>
    </ul>
</f:widget.paginate>

Background: I am using this because I have a top record (first record) which is shown differently from the other records (only on first page). So I am calling in the list action an own implementation of a find method in the repository which sets the offset in the query to 1.

I will provide a patch shortly.

Actions #1

Updated by Chris Müller over 5 years ago

  • Description updated (diff)
Actions #2

Updated by Chris Müller over 5 years ago

  • Description updated (diff)
Actions #3

Updated by Gerrit Code Review over 5 years ago

  • Status changed from New to Under Review

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

Actions #4

Updated by Gerrit Code Review about 5 years ago

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

Actions #5

Updated by Gerrit Code Review about 5 years ago

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

Actions #6

Updated by Gerrit Code Review about 5 years ago

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

Actions #7

Updated by Chris Müller about 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #8

Updated by Benni Mack almost 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF