diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php index 8c6348cc4eb5f7f6e728f6fa34cafa165426b22e..1447dd9946beec8792f302b1c2798a899946b9c4 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php @@ -310,8 +310,11 @@ class Backend implements BackendInterface, SingletonInterface $classSchema = $this->reflectionService->getClassSchema($className); foreach ($classSchema->getDomainObjectProperties() as $property) { $propertyName = $property->getName(); + if (!$dataMap->isPersistableProperty($propertyName)) { + continue; + } $propertyValue = $object->_getProperty($propertyName); - if (!$dataMap->isPersistableProperty($propertyName) || $this->propertyValueIsLazyLoaded($propertyValue)) { + if ($this->propertyValueIsLazyLoaded($propertyValue)) { continue; } $columnMap = $dataMap->getColumnMap($propertyName); @@ -601,8 +604,11 @@ class Backend implements BackendInterface, SingletonInterface $classSchema = $this->reflectionService->getClassSchema($className); foreach ($classSchema->getDomainObjectProperties() as $property) { $propertyName = $property->getName(); + if (!$dataMap->isPersistableProperty($propertyName)) { + continue; + } $propertyValue = $object->_getProperty($propertyName); - if (!$dataMap->isPersistableProperty($propertyName) || $this->propertyValueIsLazyLoaded($propertyValue)) { + if ($this->propertyValueIsLazyLoaded($propertyValue)) { continue; } $columnMap = $dataMap->getColumnMap($propertyName); @@ -906,11 +912,11 @@ class Backend implements BackendInterface, SingletonInterface $classSchema = $this->reflectionService->getClassSchema($className); foreach ($classSchema->getDomainObjectProperties() as $property) { $propertyName = $property->getName(); - $propertyValue = $object->_getProperty($propertyName); $columnMap = $dataMap->getColumnMap($propertyName); if ($columnMap === null) { continue; } + $propertyValue = $object->_getProperty($propertyName); if ($property->getCascadeValue() === 'remove') { if ($columnMap->getTypeOfRelation() === ColumnMap::RELATION_HAS_MANY) { foreach ($propertyValue as $containedObject) { diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php index 9ba598cd4fbd7a13543dbb261cafc88142981d39..2eed541d44e0f5c7df9d52d4dfb76b0af591f2de 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php @@ -383,10 +383,9 @@ class Typo3DbBackend implements BackendInterface, SingletonInterface $classSchema = $this->reflectionService->getClassSchema($className); foreach ($classSchema->getDomainObjectProperties() as $property) { $propertyName = $property->getName(); - $propertyValue = $object->_getProperty($propertyName); - // @todo We couple the Backend to the Entity implementation (uid, isClone); changes there breaks this method if ($dataMap->isPersistableProperty($propertyName) && $propertyName !== AbstractDomainObject::PROPERTY_UID && $propertyName !== AbstractDomainObject::PROPERTY_PID && $propertyName !== 'isClone') { + $propertyValue = $object->_getProperty($propertyName); $fieldName = $dataMap->getColumnMap($propertyName)->getColumnName(); if ($propertyValue === null) { $whereClause[] = $queryBuilder->expr()->isNull($fieldName); diff --git a/typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Domain/Model/DateTimeImmutableExample.php b/typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Domain/Model/DateTimeImmutableExample.php index e1f8f7633e60ee9365bea78e4f31a5fc779386b5..71405d4bc695e76e96bf4bef51a3d1978020c468 100644 --- a/typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Domain/Model/DateTimeImmutableExample.php +++ b/typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Domain/Model/DateTimeImmutableExample.php @@ -21,6 +21,24 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; class DateTimeImmutableExample extends AbstractEntity { + /** + * Static value which is not part of an "entity". + * (this property has to be ignored by Extbase when persisting this entity) + */ + public static string $publicStaticValue; + + /** + * Transient value, having a name starting with `_`. + * (this property has to be ignored by Extbase when persisting this entity) + */ + public string $_publicTransientValue; + + /** + * Transient value without any getter or setter. + * (this property has to be ignored by Extbase when persisting this entity) + */ + private string $privateTransientValue; // @phpstan-ignore-line since it is unused on purpose + /** * A datetimeImmutable stored in a text field */