-
Notifications
You must be signed in to change notification settings - Fork 639
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Deprecate broken buildQueryParameters hook
This change deprecates the "buildQueryParameters" hook in three different classes and adds two new hooks in DatabaseRecordList and PageLayoutView to modify the current query. With #82334 a cleanup of AbstractRecordList has introduced the same hook into multiple classes, which breaks existing hooks, because of the sixth parameter which can be one of three different classes without a common parent class or interface. This makes it impossible to use a type hint in the hook class. Another problem is: an extension which implements the hook for the list module and uses a type hint will break the page module. The same query manipulation can be achieved with the two new hooks, which have a separate identifier. Resolves: #83740 Related: #82334 Releases: master Change-Id: Ie3b2c8082f86c6632400a8194dca4ca244b428bc Reviewed-on: https://review.typo3.org/55512 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Joerg Boesche <typo3@joergboesche.de> Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com> Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com> Reviewed-by: Susanne Moog <susanne.moog@typo3.org> Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com> Tested-by: Susanne Moog <susanne.moog@typo3.org>
- Loading branch information
1 parent
629d6fd
commit 4f17dd0
Showing
6 changed files
with
130 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...on/Changelog/master/Deprecation-83740-CleanupOfAbstractRecordListBreaksHook.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.. include:: ../../Includes.txt | ||
|
||
=============================================================== | ||
Deprecation: #83740 - Cleanup of AbstractRecordList breaks hook | ||
=============================================================== | ||
|
||
See :issue:`83740` | ||
|
||
Description | ||
=========== | ||
|
||
The hook `$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList']['buildQueryParameters']` | ||
has been marked as deprecated. It was a hook to modify the current database query but used in multiple classes which | ||
leads to some issues. For this reason, the old hook is now deprecated and will be removed in v10. | ||
|
||
|
||
Impact | ||
====== | ||
|
||
Registering a hook in `$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList']['buildQueryParameters']` will trigger a deprecation warning. | ||
|
||
|
||
Affected installations | ||
====================== | ||
|
||
Instances with extensions using a `$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList']['buildQueryParameters']`-hook | ||
|
||
|
||
Migration | ||
========= | ||
|
||
Two new hooks are available to achieve the same things. | ||
|
||
Please see: | ||
|
||
Feature-83740-CleanupOfAbstractRecordListBreaksHook.rst | ||
|
||
.. index:: Backend, Database, PHP-API, FullyScanned |
54 changes: 54 additions & 0 deletions
54
...tation/Changelog/master/Feature-83740-CleanupOfAbstractRecordListBreaksHook.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
.. include:: ../../Includes.txt | ||
|
||
=========================================================== | ||
Feature: #83740 - Cleanup of AbstractRecordList breaks hook | ||
=========================================================== | ||
|
||
See :issue:`83740` | ||
|
||
Description | ||
=========== | ||
|
||
A new hook in :php:`DatabaseRecordList` and :php:`PageLayoutView` allows modify the current database query. | ||
|
||
Register the hook via | ||
|
||
* php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class]['modifyQuery']` | ||
* php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Backend\View\PageLayoutView::class]['modifyQuery']` | ||
|
||
in the extensions :file:`ext_localconf.php` file. | ||
|
||
Example | ||
======= | ||
|
||
An example implementation could look like this: | ||
|
||
:file:`EXT:my_site/ext_localconf.php` | ||
|
||
.. code-block:: php | ||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class]['modifyQuery'][1313131313] = | ||
\MyVendor\MySite\Hooks\DatabaseRecordListHook::class . '->modifyQuery'; | ||
:file:`EXT:my_site/Classes/Hooks/DatabaseRecordListHook.php` | ||
|
||
.. code-block:: php | ||
namespace MyVendor\MySite\Hooks; | ||
class DatabaseRecordListHook | ||
{ | ||
public function modifyQuery( | ||
array $parameters, | ||
string $table, | ||
int $pageId, | ||
array $additionalConstraints, | ||
array $fieldList, | ||
\TYPO3\CMS\Core\Database\Query\QueryBuilder $queryBuilder | ||
) { | ||
// modify $queryBuilder | ||
} | ||
} | ||
.. index:: Backend, Database, PHP-API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters