Issue Bug Closed

#90607Useless $parameters variable in "modifyQuery" hooks

Christian Eßl 03/01/20, 13:00 updated 03/08/20, 13:39

Description

The following classes use the new “modifyQuery” hooks since TYPO3 9.4:
  • \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList
    uses $GLOBALS[‘TYPO3_CONF_VARS’][‘SC_OPTIONS’][DatabaseRecordList::class][‘modifyQuery’]
  • \TYPO3\CMS\Backend\View\PageLayoutView
  • \TYPO3\CMS\Backend\View\BackendLayout\ContentFetcher (new Replacement for PageLayoutView)
    use $GLOBALS[‘TYPO3_CONF_VARS’][‘SC_OPTIONS’][PageLayoutView::class][‘modifyQuery’]

All of these hooks use a $parameters argument, which is never used at all.

The one in DatabaseRecordList holds the following values:

$parameters = [
            'table' => $table,
            'fields' => $fieldList,
            'groupBy' => null,
            'orderBy' => null,
            'firstResult' => $this->firstElementNumber ?: null,
            'maxResults' => $this->iLimit ?: null
        ];

$table and $fieldList are already assigned as separate arguments to modifyQuery(). Only the ‘firstResult’ and ‘maxResults’ are actually useful in the hook as information.

But in both the hooks for PageLayoutView and ContentFetcher $parameters only holds this information:

$parameters = [
            'table' => $table,
            'fields' => $fields,
            'groupBy' => null,
            'orderBy' => null
        ];

Which makes the $parameters array for both of these hooks completely useless and misleading.

Reviews 0

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