Reverse synchronization, that is moving values from the legacy properties to the replacing fields, happens before saving to ensure that any alteration performed by modules to the properties is not lost.

Currently reverse synchronization happens before saving an entity and (possibly) after saving it to account for the fact that Title has a very low weight and that modules might alter the legacy property after reverse sychronization has happened. This has both performance and reliability implications, AAMOF after saving an entity, straight synchronization might be needed again (for instance see title_tokens_alter()).

We need to implement hook_module_implements() to ensure reverse synchronization happens only before saving but after any other implementation of hook_entity_presave(), which luckily is called after the entity-specifc presave hooks.

Comments

plach’s picture

Status: Active » Needs review
StatusFileSize
new3.23 KB

Here is a patch: with it Title gains a very high weight but by default hook implementations are moved as first to ensure the current behavior is retained except for reverse synchronization.

plach’s picture

Issue tags: +Needs tests

This might need tests. Tagging to ensure I don't forget about it.

plach’s picture

StatusFileSize
new3.44 KB

Fixed bogus update function.

plach’s picture

Status: Needs review » Reviewed & tested by the community
plach’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed.

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 069be7c on 7.x-1.x, workbench by plach:
    Issue #1620986 by plach: Perform reverse synchronization more reliably.