Problem/Motivation
Let's say I have a node (ID: 1) with some paragraphs set on it.
I cloned the node 1 with the paragraphs. And i have a new node 2, the cloned node.
Then if I un-publish the node 2, all the paragraphs set on node 1 are not visible for anonymous users. (because anonymous users can't view unpublished node).
After debugging, it appears that on the node 1, all the original paragraphs have as parent ID the node 2 ID.
If I edit node 1, edit all the paragraphs, then the right parent ID is set on the node 1 's paragraphs, after saving the original node.
Proposed resolution
TODO : Find the root cause. I guess that original paragraphs have the parent ID set on the new node cloned ID, before being cloned themself.
Remaining tasks
Confirm the bug
Write failing tests
Fix the bug
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
N/A
Comments
Comment #2
flocondetoileComment #3
flocondetoileNot sure if this bug is related to entity_clone or entity_reference_revision module.
Comment #4
flocondetoileThe thing happens in the postsave() method of EntityReferenceRevisionsItem class
The $parent_entity is the new node cloned and so the parent_id is updated. But this shouldn't occurs as, theorically, the original paragraph shouldn't be saved.
Comment #5
flocondetoileAs a workaround, with an event subscriber you can re-save the original entity to trigger again the postsave() method and set the right parent_id on the original paragraphs.
Comment #6
dpavon commentedI would say this is related to the "corrupt" paragraph issue in #3060223
Comment #7
idebr commentedIt is. Let's close this issue as a duplicate, so we can focus our efforts in the related issue.