X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/blobdiff_plain/9b3a0450862dc984594a6c14fb604df169720daa..d8befaf754ecfbb5d5713fcfc2d6a5441731921d:/typo3/sysext/extbase/Classes/Persistence/Backend.php diff --git a/typo3/sysext/extbase/Classes/Persistence/Backend.php b/typo3/sysext/extbase/Classes/Persistence/Backend.php index d6e40aea9287..f6eca1d24756 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Backend.php +++ b/typo3/sysext/extbase/Classes/Persistence/Backend.php @@ -431,7 +431,7 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn * @param Tx_Extbase_Persistence_ObjectStorage $objectStorage The object storage to be persisted. * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The parent object. One of the properties holds the object storage. * @param string $propertyName The name of the property holding the object storage. - * @param array $row The row array of the parent object to be persisted. It's passed by reference and gets filled with either a comma separated list of uids (csv) or the number of contained objects. + * @param array $row The row array of the parent object to be persisted. It's passed by reference and gets filled with either a comma separated list of uids (csv) or the number of contained objects. * @return void */ protected function persistObjectStorage(Tx_Extbase_Persistence_ObjectStorage $objectStorage, Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, array &$row) { @@ -748,14 +748,8 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn * @return void */ protected function addCommonFieldsToRow(Tx_Extbase_DomainObject_DomainObjectInterface $object, array &$row) { - $className = get_class($object); - $dataMap = $this->dataMapper->getDataMap($className); - if ($object->_isNew() && ($dataMap->getCreationDateColumnName() !== NULL)) { - $row[$dataMap->getCreationDateColumnName()] = $GLOBALS['EXEC_TIME']; - } - if ($dataMap->getModificationDateColumnName() !== NULL) { - $row[$dataMap->getModificationDateColumnName()] = $GLOBALS['EXEC_TIME']; - } + $dataMap = $this->dataMapper->getDataMap(get_class($object)); + $this->addCommonDateFieldsToRow($object, $row); if ($dataMap->getRecordTypeColumnName() !== NULL && $dataMap->getRecordType() !== NULL) { $row[$dataMap->getRecordTypeColumnName()] = $dataMap->getRecordType(); } @@ -764,6 +758,23 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn } } + /** + * Adjustes the common date fields of the given row to the current time + * + * @param Tx_Extbase_DomainObject_DomainObjectInterface $object + * @param array $row The row to be updated + * @return void + */ + protected function addCommonDateFieldsToRow(Tx_Extbase_DomainObject_DomainObjectInterface $object, array &$row) { + $dataMap = $this->dataMapper->getDataMap(get_class($object)); + if ($object->_isNew() && $dataMap->getCreationDateColumnName() !== NULL) { + $row[$dataMap->getCreationDateColumnName()] = $GLOBALS['EXEC_TIME']; + } + if ($dataMap->getModificationDateColumnName() !== NULL) { + $row[$dataMap->getModificationDateColumnName()] = $GLOBALS['EXEC_TIME']; + } + } + /** * Iterate over deleted aggregate root objects and process them * @@ -789,13 +800,15 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn $tableName = $dataMap->getTableName(); if (($markAsDeleted === TRUE) && ($dataMap->getDeletedFlagColumnName() !== NULL)) { $deletedColumnName = $dataMap->getDeletedFlagColumnName(); + $row = array( + 'uid' => $object->getUid(), + $deletedColumnName => 1 + ); + $this->addCommonDateFieldsToRow($object, $row); $res = $this->storageBackend->updateRow( $tableName, - array( - 'uid' => $object->getUid(), - $deletedColumnName => 1 - ) - ); + $row + ); } else { $res = $this->storageBackend->removeRow( $tableName,