Add hook_entity_postsave hook

Created on 19 March 2014, about 10 years ago
Updated 14 March 2024, 3 months ago

Problem/Motivation

In order to intercept an entity after it has saved, both hook_entity_insert and hook_entity_update must be implemented.

Proposed resolution

Add hook_entity_postsave. Detect if entity is new or being updated using entity API: $entity->isNew()

Remaining tasks

User interface changes

None

API changes

Deprecate hook_entity_[type_]insert and hook_entity_[type_]update.

Data model changes

Original report by ivanjaros β†’

We already have a hook_entity_presave hook so why don't we also have hook_entity_postsave?
In current state if I want to run some logic after the entity hase been saved, and I don't care if it is/was new or already existing entity, I have to implement TWO hooks instead of just one: hook_entity_insert AND hook_entity_update.

✨ Feature request
Status

Needs work

Version

11.0 πŸ”₯

Component
EntityΒ  β†’

Last updated 1 day ago

Created by

Live updates comments and jobs are added and updated live.

Missing content requested by

πŸ‡¦πŸ‡ΊAustralia dpi
5 months ago
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024