[FEATURE] Introduce afterPersistObjetct signal slot 38/31238/4
authorNico de Haen <mail@ndh-websolutions.de>
Sun, 29 Jun 2014 22:11:09 +0000 (00:11 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 1 Jul 2014 19:07:23 +0000 (21:07 +0200)
At the moment we only have an afterUpdate signal which
is emitted when an object is updated. But we don't have
a signal which is emitted after persisting an existing
aggregate root, if only sub objects or object storages
belonging to the aggregate root are updated.

Since the aggregate root should "encapsulate" the contained
objects to the outer world, we should provide such a signal,
which is fired if all objects of an aggregate root are persisted.

The same signal is emitted in the persistObject method in
the AbstractBackend class in Flow.

Change-Id: I85b2257b127f73afddbf4a01db156ed30489c42a
Resolves: #59986
Releases: 6.3
Reviewed-on: https://review.typo3.org/31238
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php

index f8e673c..57734fa 100644 (file)
@@ -394,6 +394,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
                foreach ($queue as $queuedObject) {
                        $this->persistObject($queuedObject);
                }
+               $this->emitAfterPersistObjectSignal($object);
        }
 
        /**
@@ -879,6 +880,15 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
        }
 
        /**
+        * Emits a signal after an object was persisted
+        *
+        * @param DomainObjectInterface $object
+        */
+       protected function emitAfterPersistObjectSignal(DomainObjectInterface $object) {
+               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterPersistObject', array($object));
+       }
+
+       /**
         * Adds common databse fields to a row
         *
         * @param \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $object