Add events for matching entity hooks

Created on 15 August 2015, almost 9 years ago
Updated 31 January 2024, 5 months ago

One of the most visible places where developers and site builders will still need to interact with hooks are the entity lifecycle hooks (presave/create/insert/update/predelete/delete).

Now that we have our own reasonably performant EventDispatcher, there is no reason not to fire an event every time the matching hook is fired.

Contrib can do this by overriding the invokeHook() method of the controller, but core should do this too as soon as possible.

Open question:
Use one generic event (EntityEvent with a getEntity() and getEntityTypeId() methods) or a class per entity type (NodeEvent with a getNode()), defined via the entity annotation. Or both? (use the generic event if the more specific one isn't declared).

The same choice will reflect on the event id as well.

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Entity  →

Last updated about 3 hours ago

  • Maintained by
  • 🇬🇧United Kingdom @catch
  • 🇨🇭Switzerland @Berdir
  • 🇩🇪Germany @hchonov
Created by

🇷🇸Serbia bojanz

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • needs profiling

    It may affect performance, and thus requires in-depth technical reviews and profiling.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

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.69.0 2024