I may be going about this incorrectly, and please let me know if there is a better way, but I have a module that needs to react when a registration is being deleted. I would like to use the hook_entity_delete to make this happen but this is not currently available.

I would like to propose the following patch as a fix.

Comments

mgifford’s picture

Issue summary: View changes

Patch applies nicely. I haven't tested the functionality, but think it would be a useful addition.

CountPacMan’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Status: Needs review » Fixed

Tested! Thanks for the patch. Will push to dev.

  • CountPacMan committed be3da4f on 7.x-1.x
    Issue #2105193 by aaronott: Allow other modules to react to a...
gcb’s picture

Status: Fixed » Closed (works as designed)

Upon review, this commit has been reversed here:

http://cgit.drupalcode.org/registration/commit/?id=7ca273e

Sorry @CountPacMan, you asked me about this in person and I didn't listen closely enough. module_invoke_all('entity_delete'); is called by the entity system. It is automatically invoked for all entities, of which Registrations are one. This patch adds no new functionality, but it does result in a long spew of errors and notices.

I'm curious why the original posters thought this was needed? I have tested the original code and hook_entity_delete() is invoked on direct registration deletes or on calls to delete_multiple triggered by, for example, a user with registrations being deleted.