Hi @geek-merlin, did you manage to proceed with anything on this?
I also need to log the changes in a Nested paragraph field but as you I can't see any original values in any hook:presave.
* Have a (non-revisionable, e.g. user) entity and a field_paragraph
* Solve a problem where you need to act depending on the paragraph change (so need the original paragraph) *and* the host entity ID.
Expected:
* In hook_user_insert, developer can access $user->original->field_paragraph *or* $user->field_paragraph->original to get the original paragraph
Experienced:
* Nope
Note that acting in hook_paragraph_insert is not a workaround as $user->id() is not determined here.
OTOH, in hook_user_insert, the paragraph is already saved and $paragraph->original had been deleted by EntityStorageBase::doPostSave.
I worked around this by some userland caching of the original paragraph, but this is plain insane and a real kitten massacre.
I see 2 viable approaches:
a) Enrich $entity->original:
* 1) In presave, when $entity->original is set, care that all entityreference fields get a clone of its referenced entity.
b) Make $paragraph->original endure:
* 1) (By deferring the unset()) Somehow prevent or undo deleting $paragraph->original after paragraph save. Then delete it after last host entity is saved.
Active
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Hi @geek-merlin, did you manage to proceed with anything on this?
I also need to log the changes in a Nested paragraph field but as you I can't see any original values in any hook:presave.