Bug #83842

buildQueryParameters Hook cannot overrride SQL Limit

Added by Paul Beck 12 days ago. Updated 11 days ago.

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

0%

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.

History

#1 Updated by Tymoteusz Motylewski 12 days ago

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

#2 Updated by Paul Beck 11 days 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;

        }
    }

Also available in: Atom PDF