Problem/Motivation
Right now, the Entity Reference revision field item creates a new revision from the referenced entity whenever the host entity being saved is a new revision. This is fine in 99% of the situations, but if you migrate content entity revisions, this behaviour creates new revisions from the entities referenced by an entity_reference_revisions field.
Steps to reproduce
Execute the test at #2977853-33: [PP-4] Multifield to Paragraphs migration.
Proposed resolution
Check the value of an unmapped (so unsaved) field property, e.g. needs_resave (or skip_new_revision). If it is explicitly set to FALSE (or TRUE), then don't create a new revision.
Remaining tasks
@tbd
User interface changes
Nothing
API changes
@tbd
Data model changes
Nothing.
| Comment | File | Size | Author |
|---|
Issue fork entity_reference_revisions-3218312
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
huzookaLet's see what it breaks (no new test(case)s, just a "fix").
Comment #3
wim leersIt fails only on PHP 8 with this error in a bunch of different test cases:
That seems a general PHP 8 compatibility problem in this module, because this patch does nothing of the sort! /me checks… Yep, confirmed: https://www.drupal.org/node/2411903/qa.
Conclusion: this is passing all tests :) Which is good, because it's barely changing anything!
Comment #4
huzookaI'm not happy with the property's name, so suggestions are very welcome!
Comment #5
berdirAny chance we can rely on the new syncing flag that core has instead of implementing our own thing. Not sure.
Also, dont use $this->getValue()[], that has to loop over all properties and stuff and might do weird things during a save. rely on __get() or just the values property directly. IMHO $this->needs_resave (or whatever we decide to use ) is fine, there is no better way right now to access that.
Comment #6
huzooka@berdir, do you mean SynchronizableInterface?
Comment #7
junaidpvI am facing same issue with a migration from D7 to D9.5.
@huzooka where did you set value for "needs_resave" ?
Comment #10
mikelutzSorry for the laxy PR with no tests, but I need the patch for a project right now. Will try to circle back around when I get a chance with tests.
Comment #11
fjgarlin commented#2984027: Incorrect manipulation of default revision flag changes the code around this issue, and neither the patch nor the MR is applicable now.
Comment #14
fjgarlin commentedhttps://git.drupalcode.org/project/entity_reference_revisions/-/merge_re... should be applicable as it was created over a rebased branch. I created a new branch / MR because it was easier than rebasing for this small change. MR45 can be closed in favor of this one.