- 🇫🇷France tostinni
Here is a shot at it.
The problem is causing by the fact that the functionentityShouldBeSaved
is only checking base fields of the entity, thus when a reference is present it will only check its target_id which won't change if any of the referenced entity field is changed.The patch add a nested logic to drill into fields of
entity_reference
(nodes, terms, medias...) andentity_reference_revisions
(used for paragraphs).We had to add a check for $new_field to be a valid field as in some case we had strings., so I guess a few eyeballs on this should help.
- 🇮🇳India sjnija
Fix in #5 worked well for me.
I’m attaching a patch that uses entity comparison: instead of recursively checking each referenced entity, it serializes both entities' field values using toArray() and compares the resulting arrays. This array-based solution is a clean and efficient alternative for detecting changes in referenced entities such as paragraphs.