Move $entity->original to a separate hook argument

Created on 13 March 2012, almost 13 years ago
Updated 30 November 2024, 22 days ago

The original entity is currently passed as piggy-backed property $entity->original. It's useful to have it, but it's not very visible there.

What about moving from

hook_entity_update($entity, $type)
hook_{entity_type}_update($node)

to

hook_entity_update($entity, $entity_original)
hook_{entity_type}_update($entity, $entity_original)

Analogously for the presave hooks, e.g.

hook_entity_presave($entity, $entity_original = NULL)

If we do so we could scratch $entity->original. However, currently the existence of $entity->original allows for more efficient mass-updates as original can be multiple-loaded. So what about providing entity_save_multiple($entities) which already handles that efficiently?

📌 Task
Status

Closed: duplicate

Version

11.0 🔥

Component

entity system

Created by

🇦🇹Austria fago Vienna

Live updates comments and jobs are added and updated live.
  • API change

    Changes an existing API or subsystem. Not backportable to earlier major versions, unless absolutely required to fix a critical bug.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024