Project

General

Profile

Actions

Bug #83842

closed

buildQueryParameters Hook cannot overrride SQL Limit

Added by Paul Beck almost 7 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Could have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2018-02-10
Due date:
% Done:

0%

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

Description

The buildQueryParameters passes a parameter "maxResults" to possibile hooks. Unfortunaly It does not matter if a hook changes the maxResults because the "$iLimit" of /sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php will be set to 100 by default or a tables $TCA ['interface']['maxSingleDBListItems'] setting at line 493.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Epic #88027: Properly handle Hooks/Signals and EventsClosedBenni Mack2022-04-22

Actions
Actions #1

Updated by Tymoteusz Motylewski almost 7 years ago

Hi Paul,
Thanks for your report.
Can you provide more details how to reproduce the issue?
Thanks a lot!

Actions #2

Updated by Paul Beck almost 7 years ago

Tymoteusz Motylewski wrote:

Hi Paul,
Thanks for your report.
Can you provide more details how to reproduce the issue?
Thanks a lot!

Create an extension and register to the Hook

// DatabaseRecordList hook to process the query
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\\CMS\\Recordlist\\RecordList\\DatabaseRecordList']['buildQueryParameters'][] =
    \PB\Quicklist\Hooks\DatabaseRecordList::class;

In your hook change the parameters $parameters['maxResults'] to anything and it will not affect to the web_list singletable-view.

/**
     * @param array $parameters parameters
     * @param string $table the current database table
     * @param int $pageId the records' page ID
     * @param array $additionalConstraints additional constraints
     * @param array $fieldList field list
     * @param AbstractDatabaseRecordList $parentObject
     *
     * @throws \InvalidArgumentException
     */
    public function buildQueryParametersPostProcess(array &$parameters,
                                   string $table,
                                   int $pageId,
                                   array $additionalConstraints,
                                   array $fieldList,
                                   AbstractDatabaseRecordList $parentObject)
    {
        if ($parentObject->table !== null && GeneralUtility::_GP('M') === 'web_list') {

            $parameters['maxResults'] = 150;

        }
    }
Actions #3

Updated by Benni Mack over 5 years ago

  • Related to Epic #88027: Properly handle Hooks/Signals and Events added
Actions #4

Updated by Christian Eßl over 4 years ago

  • The "buildQueryParameters" hook has been removed in TYPO3 10.
  • The $parameters argument for this hook was already deprecated in TYPO3 9 in favor of the $queryBuilder argument.
  • In 10 there are two new hooks that replace the old one:

    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class]['modifyQuery']
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Backend\View\PageLayoutView::class]['modifyQuery']

Both of these hooks also support the $parameters argument, but it looks like this variable is never actually used? This argument is now probably just there for holding information.
Instead, the $queryBuilder argument should be used by calling $queryBuilder->setMaxResults();

So this issue should be obsolete.

Actions #5

Updated by Susanne Moog over 4 years ago

  • Status changed from New to Closed

See last comment.

Actions

Also available in: Atom PDF