[BUGFIX] Coalesce hook calls in DataHandler::processRemapStack() 52/51552/17
authorThomas Hohn <thomas@hohn.dk>
Mon, 6 Feb 2017 11:01:25 +0000 (12:01 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Thu, 30 Mar 2017 10:16:02 +0000 (12:16 +0200)
commit0dfac264de6cb24cf16a29dc955a6e2105c98f97
treefa2ee6ec25e64c2672468c8e8347c67825976dc4
parent89124062cceb79ec61298ebd69df7ec50d95e107
[BUGFIX] Coalesce hook calls in DataHandler::processRemapStack()

DataHandler's hook processDatamap_afterDatabaseOperations is processed
in two ways. In case modifications do not contain any new relation that
just has been created, the hook is executed directly. If that's not the
case, executing this hook is deferred and will happen after the remap
stack has been processed.

Calling the hook directly happens exactly once for each modified record,
where invocations in DataHandler::processRemapStack() might happen more
than once, depending on the amount of relation fields that contain new
references and have been remapped.

This change coalesces these invocations which results that the hooks
processDatamap_afterDatabaseOperations is exactly called once for each
modified record - which is the expected behavior.

Change-Id: Ib7e65ce170c8f9ba8f7577b79073b1ed9213a0b9
Resolves: #79635
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/51552
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Tested-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/HookTest.php