Problem/Motivation
Currently when loading revisions in SqlContentEntityStorage::loadRevision()
we do not statically cache the instantiated objects. Aside from the performance implications, this has the major drawback of instantiating a new entity object every time. If the same entity is loaded twice and two entity objects are instantiated, we will end-up having broken internal translation objects references. This means changes to field data will not be propagated to the various translations, which in turn means that if the two objects are saved, the latter will override the former, and a data loss will result. The mitigating factor is that we normally do not save revision objects, however the entity objects could marked as the default revision and then saved.
Proposed resolution
Add static caching support also for entity revision loading in ContentEntityStorageBase
, so that all storage backends can automatically leverage it.
Remaining tasks
- Validate the proposed solution
- Write a patch
- Review it
User interface changes
None
API changes
Probably only additions.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2503025-1.patch | 1.41 KB | joshi.rohit100 |
Comments
Comment #1
joshi.rohit100FIrst try for SqlContentEntityStorage (if i got it right ).
Comment #5
Berdir#2620980: ContentEntityStorageBase::loadRevision() should use the static and the persistent entity cache like ContentEntityStorageBase::load()