I believe this is a bug because in #2771523: support host revision delete it says "As we are creating new revisions in sync." Plus, if a composite entity is defined as part of the host's data then the versions that exist in the host's old revisions should not be able to be changed. The latest revision of the host should therefore always be pointing to a unique revision of the composite entity that isn't pointed to by any of the host's other revisions.
In typical use this is handled by a widget in the paragraph's module, but it makes more sense to define the revision behaviour of composite entities in this module, and making sure each host revision points to a unique target revision without exception will make related features easier to implement.
Comment | File | Size | Author |
---|---|---|---|
#25 | entity_reference_revisions_2801321_save.interdiff.txt | 1.12 KB | miro_dietiker |
#20 | new_host_revisions_do-2801321-20.patch | 5.61 KB | Ginovski |
| |||
#20 | interdiff-2801321-16-20.txt | 1.89 KB | Ginovski |
#16 | new_host_revisions_do-2801321-16.patch | 3.34 KB | Ginovski |
#5 | err-new_revisions-2801321-5.patch | 2.98 KB | jmuzz |
|
Comments
Comment #2
jmuzz CreditAttribution: jmuzz commentedDon't have a solution yet, but this should show that the revisions aren't getting made.
Comment #4
jmuzz CreditAttribution: jmuzz commentedComment #5
jmuzz CreditAttribution: jmuzz commentedAdded tests for #2800793: Reverting host to an old revision should create new revision of composite entities.
Comment #6
johnchqueCan we get a test-only patch?
Comment #7
jmuzz CreditAttribution: jmuzz commentedThe test-only patch is in #2.
Comment #8
miro_dietikerPromoting.
As a side effect, you touch this area:
We discussed once that we are not properly doing the default revision handling now. But we also realised that we are not relying on the default revision until now.
Maintaining the default revision also really makes sense from a performance perspective. It is faster to load it as the entity cache works.
But the problem is, we currently always load by revision, which circumvents it as far as i know.
So as a result, when loading the paragraphs, we could check if the host isDefaultRevision and then load the default revision instead of a specific revision. This would get us the entity cache back.
Passing to Berdir to get more qualified feedback.
Comment #9
BerdirYes, I think that makes sense.
We have a separate issue for that already, we can discuss that there: https://www.drupal.org/node/2673076
now that we no longer save too many new revisions, there shouldn't be a blocker for trying to do that. Or we can also just try to push the core issues that are trying add static and persistent caching for revision loading. That would be even better.
Comment #11
miro_dietikerCommitting. Plus updating the other issue.
Comment #13
miro_dietikerPeople say, this issue commit broke Paragraphs.
If we revert this, we need another release to make Paragraphs pass again.
Comment #15
miro_dietikerSo i reverted. No release needed as the commit was after the last release.
We can discuss now how we can fix this cleanly.
Comment #16
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedAdded an if/else for the parent::preSave.
The parent was also saving the entity, that is why there was an extra revision in paragraphs. With this patch, paragraphs tests don't fail.
Comment #18
BerdirWe should have an explicit test for this here as well. We already have a composite test, we should be able to extend it so that the initial save doesn't result in more than one revision.
Comment #19
johnchqueI don't think we have to do all in ERR, we are in this issue moving almost all the revision management to this module thus there might be errors in Paragraphs (which should work based on this revision management in ERR).
So we have to remove the revision management in paragraphs to rely on ERR only.
Comment #20
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedAdded an assertion for the revisions count.
Comment #22
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedComment #23
Berdirpatch in patch, don't forget to remove that.
Comment #25
miro_dietikerparent::preSave should always be called except clearly expressed..
Berdir pointed out that hasNewEntity() should be called before though.
I changed, passing local. Committing.
Comment #27
effulgentsia CreditAttribution: effulgentsia at Acquia commentedI appreciate the original motivation behind this issue, but I think there are also good reasons to allow composite entities to not have a new revision generated when they have not been edited. I opened #3267490: Allow composite entities to opt out of creating duplicate revisions to explore if and how we want to support that.