[FEATURE] Implement endInsertObject signal after object is registered 95/34395/9
authorJacob Rasmussen <jacob@omnius.dk>
Thu, 20 Nov 2014 14:26:24 +0000 (15:26 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 13 Dec 2014 16:09:33 +0000 (17:09 +0100)
By implementing a new signal when a newly persisted object is
registered in the persistence session, it is possible to manipulate
and persist the object using the repository update method.

Change-Id: Icd4da1b55ce0ea3546ec8aa46240da54afefa960
Resolves: #63100
Releases: master
Reviewed-on: http://review.typo3.org/34395
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php

index 4e99cfd..7d028d2 100644 (file)
@@ -639,6 +639,9 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
                        $this->referenceIndex->updateRefIndexTable($dataMap->getTableName(), $uid);
                }
                $this->session->registerObject($object, $uid);
+               if ((int)$uid >= 1) {
+                       $this->emitEndInsertObjectSignal($object);
+               }
        }
 
        /**
@@ -651,6 +654,16 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
        }
 
        /**
+        * Emits a signal after an object was registered in persistence session
+        * This signal replaces the afterInsertObject signal which is now deprecated
+        *
+        * @param DomainObjectInterface $object
+        */
+       protected function emitEndInsertObjectSignal(DomainObjectInterface $object) {
+               $this->signalSlotDispatcher->dispatch(__CLASS__, 'endInsertObject', array($object));
+       }
+
+       /**
         * Tests, if the given Value Object already exists in the storage backend and if so, it returns the uid.
         *
         * @param \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject $object The object to be tested