Problem/Motivation
In D7, cloning a paragraphed node led to data loss #2394313: Paragraphs data loss with Node Clone module
That's because the paragraphs are then shared...
In D8 that's not possible anymore with the new entity reference revisions (ERR) composite relationship.
However, we need to make sure that a cloned node does not steal the paragraphs (forcing an update of the parent relationship.)
And we know from other issues, that the save currently happens in the paragraphs widget and not bound the host entity save as a whole
#2676098: Do not save in widget
Proposed resolution
Identify scenarios to clone a host entity and test cover them to make sure we support them properly.
Fix them if there's inconsistency.
There might be some elements on composite reassignment that should be handled in ERR.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#49 | 2676226_49_test_only.patch | 7.73 KB | slashrsm |
#41 | interdiff.txt | 652 bytes | slashrsm |
#41 | 2676226_41.patch | 3.44 KB | slashrsm |
#38 | 2676226_38.patch | 3.46 KB | slashrsm |
#28 | 2676226_requires.patch | 477 bytes | slashrsm |
Comments
Comment #2
BerdirI'm not sure if a field currently can even act on a clone. createDuplicate certainly doesn't invoke a method on fields.
node_clone might add a hook but then it only works with that.
Comment #3
miro_dietikerHm yeah, we need to support cloning in the most common D8 way, like node clone was at least for D7.
If node clone will be stabilised again, then it should be this. However i think naming is bad since it should cover any entity.
I recently heard about an alternative / better approach, but can't find it anymore...
BTW also how about replicate? https://www.drupal.org/project/replicate
Comment #4
BerdirWhatever we want to support is fine with me, just saying that the core API alone won't help us get there. I see @dawehner did a replicate D8 port. afaik node_clone is being worked on too.
Comment #5
miro_dietikerWe can also wait a bit until things settle down and we have a first real use case or someone contributing integration because they need it.
Comment #6
DamienMcKennaDefinitely interested to see these working together for a site I'll theoretically be working on soon-ish, hopefully I (or a coworker) will be able to help out make it work.
Comment #7
DamienMcKennaComment #8
DamienMcKennaFYI there's WIP for a D8 port of Node Clone, and there's the newer Entity Clone module that has dev version available for it.
Comment #9
miro_dietikerIMHO cloning integration would be provided by Entity References Revision module.
Comment #10
miro_dietikerBTW both Collect and TMGMT have code ready to steal for selecting a field to recurse Entity References..
Comment #11
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedAttached patch provides integration with Replicate module. Test will fail since the D8 port was not pushed to the drupal.org yet, but it passes locally.
Comment #15
DamienMcKennaThe tests will also fail because it can't find the Replicate module. In D7 you could just add a test_dependency[]= line to the info file, is that possible with D8?
Comment #16
miro_dietikerYeah. Plz provide a test dependency patch only first so i can commit it.
Comment #17
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedDone.
Comment #18
miro_dietikerHa! test-only doesn't really help if it's not on d.o. ;-D
Still committing, with keeping test coverage uncommitted to avoid fails until replicate is on d.o.
Attached remaining test incl. test dependency.
Comment #20
miro_dietikerComment #21
miro_dietikerOopsie, head broken. We accidentally introduced a hard dependency to the replicate module.
The service needs to be defined conditionally, with the optional dependency.
Comment #22
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedThis should fix the tests. Also confirmed uncommitted Replicate test is still passing.
Comment #24
miro_dietikerCommitted fix for HEAD.
Back to needs work for the tests.
Comment #25
miro_dietikerDear friend, why are you still failing!
Comment #26
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedReplicate integration test somehow sneaked into the commit.
Comment #27
BerdirCan we try what the commit suggests? (@requires module replicate annotation) If that works, then it will automatically start to work as soon as replicate is on d.o.
And it will also not fail locally when running all tests and you don't have that module.
Not sure if it will work, I think it's still broken with simpletest but maybe it works with phpunit...
Comment #28
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedTried locally and it failed both with run-tests.sh and phpunit. Does patch look correct?
Comment #31
miro_dietikerCommitted the test removal. I accidentally committed them after adding to staging in #18... Sorry! :-)
Back for resolving the tests situation...
Comment #38
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedDiscussed this with @Berdir and he suggested slightly different approach. This does look much nicer indeed.
Comment #39
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedComment #40
Berdir:)
Comment #41
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedDammit!
Comment #42
BerdirNow it looks fine to me.
Comment #46
miro_dietikerCommitted. :-)
Comment #48
BerdirWe will still need to commit the test ;)
Comment #49
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedTest only patch.
Comment #53
miro_dietikerHm, isn't postponed the best fitting state?
Comment #54
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedReplicate has been pushed to d.o.
Comment #61
miro_dietikerYay, awesome! Sooo, what's wrong here? :-)
Comment #62
BerdirSearch api broken, I think we have to wait on the next release, monitoring also has search api test fails.
Comment #63
BerdirThe new test is passing, so it's not a problem with this issue. Didn't really review, so just needs review, not RTBC.
Comment #64
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedYup, tests failed on HEAD, which proves #62.
Comment #65
miro_dietikerTest reads much nice. Happy to commit! :-)