Bug #83842
closedbuildQueryParameters Hook cannot overrride SQL Limit
0%
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.
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!
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;
}
}
Updated by Benni Mack over 5 years ago
- Related to Epic #88027: Properly handle Hooks/Signals and Events added
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.