[+TASK] Extbase (Persistence): Circular dependencies (Post1 retaled to Post2 related...
authorJochen Rau <j.rau@web.de>
Tue, 2 Mar 2010 23:55:12 +0000 (23:55 +0000)
committerJochen Rau <j.rau@web.de>
Tue, 2 Mar 2010 23:55:12 +0000 (23:55 +0000)
typo3/sysext/extbase/Classes/Persistence/Backend.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php

index 2e52e4d..aa4df57 100644 (file)
@@ -365,11 +365,11 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
                        if (($propertyValue !== NULL) && ($propertyValue instanceof Tx_Extbase_Persistence_ObjectStorage || $propertyType === 'Tx_Extbase_Persistence_ObjectStorage')) {
                                if ($object->_isNew() || $object->_isDirty($propertyName)) {
                                        $this->persistObjectStorage($propertyValue, $object, $propertyName, $queue, $row);
-                               }
-                               if (is_array($propertyValue) || $propertyValue instanceof Iterator) {
-                                       foreach ($propertyValue as $containedObject) {
-                                               if ($containedObject instanceof Tx_Extbase_DomainObject_AbstractEntity) {
-                                                       $queue[] = $containedObject;
+                                       if (is_array($propertyValue) || $propertyValue instanceof Iterator) {
+                                               foreach ($propertyValue as $containedObject) {
+                                                       if ($containedObject instanceof Tx_Extbase_DomainObject_AbstractEntity) {
+                                                               $queue[] = $containedObject;
+                                                       }
                                                }
                                        }
                                }
@@ -768,7 +768,8 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
        protected function updateObject(Tx_Extbase_DomainObject_DomainObjectInterface $object, array &$row) {
                $tableName = $this->dataMapper->getDataMap(get_class($object))->getTableName();
                $this->addCommonFieldsToRow($object, $row);
-               $row['uid'] = $object->getUid();
+               $uid = $object->getUid();
+               $row['uid'] = $uid;
                $res = $this->storageBackend->updateRow(
                        $tableName,
                        $row
index 3272046..2b740a5 100644 (file)
@@ -151,8 +151,8 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
                        $object = $this->identityMap->getObjectByIdentifier($row->getValue('uid'), $className);
                } else {
                        $object = $this->createEmptyObject($className);
+                       $this->identityMap->registerObject($object, $row->getValue('uid'));
                        $this->thawProperties($object, $row);
-                       $this->identityMap->registerObject($object, $object->getUid());
                        $object->_memorizeCleanState();
                        $this->persistenceSession->registerReconstitutedObject($object);
                }