#70020@transient properties should be ignored when checking if object is dirty
Description
I am currently working on a REST Api for TYPO3-7 and i recognized, that i allways get TRUE when checking AbstractEntity::_isDirty()
The problem is, that @transient properties are checked also.
But by using the ObjectAccess::getProperties and stuff a @transient property will be loaded via get-method, that way an objects internal logic may set the transient property as first-level-cache. I guess i am not the only one using that possibility.
Properties starting with an underscore (_languageUid) are ignored, @transient properties should also be ignored.
That could reduce database load a lot in certain contexts.
Reviews 1
Related issues 2
History 4
-
Garvin Hicking changed Related to #111134 <span data-processor="relativetime" data-value="2026-10-18T17:55:15+00:00" > 10/18/26, 17:55 </span>
-
Alexander Schnitzler commented <span data-processor="relativetime" data-value="2026-10-18T18:09:46+00:00" > 10/18/26, 18:09 </span>
My plan here is to drop the Transient attribute altogether and rely on the TCA to decide whether a property should be mapped and tracked for
changes. This is part of a rather big epic, so I would not spend time on reintroducing the evaluation of that attribute. We do not need it technically, and it did not have much of an impact over the years. -
Alexander Schnitzler changed Related to #111136 <span data-processor="relativetime" data-value="2026-10-18T19:48:40+00:00" > 10/18/26, 19:48 </span>
Still accurate on current main, but the stated reasoning no longer holds. Details below, so
that whoever picks this up does not chase the wrong benefit.
The mechanism is unchanged
transientis a PHP attribute these days,#[Transient]from@TYPO3\CMS\Extbase\Attribute\ORM@, and
ClassSchema\Property::isTransient()exists. Thedescribed behaviour is still there:
AbstractDomainObject::_getProperties()usesget_object_vars($this)and filtersonly properties prefixed with an underscore. Transient properties stay in.
DataMapper::mapSingleRow()calls$object->_memorizeCleanState()without an argument,so everything that survived the above lands in
_cleanProperties._isDirty()without an argument iterates exactly that list, so transient properties arecompared.
But it does not cause database load
The expectation “that could reduce database load a lot” does not apply to current core.
@Backend::persistObject()@ iterates
$classSchema->getDomainObjectProperties()and skipsevery property for which
!$dataMap->isPersistableProperty($propertyName)holds – and@isPersistableProperty()@ is just
isset($this->columnMaps[$propertyName]). A transientproperty has no column, so it has no column map, so it never gets that far.
On top of that, persisting uses the property specific
$object->_isDirty($propertyName)throughout, never the argument-less variant.
$rowcan therefore not receive anything froma transient property, and the write is guarded by
if (!empty($row)).A dirty transient property triggers no UPDATE. No query, no bumped
tstamp.What the actual impact is
_isDirty()itself – the REST API case from the report. Neither_isDirty()norObjectMonitoringInterfacecarry aninternal@ annotation, so this islegitimate public API returning a wrong answer. Core itself has no such call: the only
argument-less usages are in
Backend(on anObjectStorage, which has its ownimplementation) and in
DebuggerUtility.DebuggerUtilityrenders the object as “modified”. Cosmetic, and mildly ironic, since thesame method labels those properties as
transienta few lines further down._memorizePropertyCleanState()clones every object valued property. The use case in the report is a transient property
used as a first level cache, so that object is cloned on every single reconstitution
through the DataMapper. That costs memory and invokes
__cloneon objects never designedfor it – and it happens whether or not anybody ever calls
_isDirty().Where a fix belongs
Not in
AbstractDomainObject. It is a plain object without dependency injection and wouldneed a global lookup to reach the ClassSchema, and changing
_getProperties()or@_memorizeCleanState()@ alters the contract of public API.
The clean seam is the call site,
DataMapper::mapSingleRow(). The DataMapper already has@ReflectionService@ injected and fetches the ClassSchema in several places. Instead of the
argument-less
_memorizeCleanState()it could iterate the non-transient properties and call@_memorizePropertyCleanState($propertyName)@ for each. Anyone calling
_memorizeCleanState()themselves keeps the current behaviour.
To verify while doing so: whether anything relies on
_getCleanProperty()returningsomething for a transient property. The only core call is in
Backendand concerns@ObjectStorage@ properties, which are persistable.
Suggested housekeeping
The description should be rewritten to what actually applies – a public API returning a wrong
answer, plus needless cloning on every reconstitution – otherwise the next person evaluates
this against a database load benefit that is not there. Target version is still “7 LTS”.
This is a
[TASK]for main with functional tests; it touches persistence, so not an easy one.