Bug #83842
closed
buildQueryParameters Hook cannot overrride SQL Limit
Added by Paul Beck about 6 years ago.
Updated about 4 years ago.
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.
Hi Paul,
Thanks for your report.
Can you provide more details how to reproduce the issue?
Thanks a lot!
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;
}
}
- Related to Epic #88027: Properly handle Hooks/Signals and Events added
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.
- Status changed from New to Closed
Also available in: Atom
PDF