Issue Bug Closed

#106346QueryResultPaginator does not respect ModifyQueryBeforeFetchingObjectDataEvent & ModifyResultAfterFetchingObjectDataEvent

Andreas Sommer 03/10/25, 09:16 updated 11/25/25, 10:01

Description

Modifying queries with those 2 events, were not used in QueryResultPaginator

This problem is also for versions up to TYPO3 13 not solved

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Files 1

History 4

  1. Stefan Froemken commented 03/14/25, 16:14

    Hopefully it does not respect these Events.

    You collect all data objects in your controller by:

    $cars = $this->carRepository->findAll();

    In $cars there are no collected records. No SQL query was executed. You only got a QueryResultObject with all information about a query. Nothing more.

    And this query information object will be transferred to the QueryResultPagination. And still that object does NOT work with data records. It only changes the first record to use and the max amount of records to fetch. Nothing more.

    First in your template, or when you are start looping through $cars, internally a query will be executed. And only then, both mentioned events will be called.

    So, for me it does not make sence to move or copy over these events also to QueryResultPaginator.

    I would prefer you to have a deeper look into your code why these events are not called the normal way. I have just checked Query::execute. Either with activated or deactivated $returnRawQueryResult both events are called. Please check your EventListener registration, flush cache in InstallTool, but it seems there is something broken in your environment

  2. Georg Ringer commented and changed status New Needs Feedback 03/17/25, 18:48

    totally agree to what Stefan says. does that work for you?

  3. Stefan Froemken commented and changed status Needs Feedback Closed 06/06/25, 06:19

    As there has been no feedback provided for the past three months, I will proceed to close this issue. If you need further assistance or wish to revisit this topic, please feel free to reopen the ticket at any time.

  4. Andreas Sommer commented and changed TYPO3 Version 10 12 PHP Version 7.4 8.3 11/25/25, 10:01

    Hello,

    from a technical standpoint, it is unclear why modifications made via ModifyQueryBeforeFetchingObjectDataEvent are not reflected in the pagination logic. The event’s name implies that the query is adjusted before the data retrieval process begins.

    Since extending individual repositories is not a viable solution due to the scale and effort involved, it appears that this event is simply not being taken into account for pagination.

    Is this behavior intended?

    Best regards
    Andreas