see #1115510: Entity providing modules must call field_attach_delete_bundle() in hook_uninstall()

-> Investigate whether it's possible to implement that generically for all modules relying on the entity API?

Files: 
CommentFileSizeAuthor
#5 entity_attach_bundle.patch5.65 KBfago

Comments

hm, that's problematic. Entity-providing modules can not really invoke that for all their entities as when they are uninstalled, the entity API might be already disabled/uninstalled too, so they miss the underlying API for getting the bundle objects.
Directly querying the DB is not really a solution either, once the entity-providing module want to support pluggable storage controllers.

So I'd go for a work-a-round: Let the entity API module care about it when modules providing entities via it are uninstalled + warn people disabling the entity API module that they should not do so unless all modules relying upon it are already uninstalled.

Thoughts?

That sounds about right.

You could possibly brute-force that warning by having entity API hook_system_info_alter() itself to required = TRUE if there are disabled but uninstalled modules that specify it as a dependency.

See also #1199946: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed.

I really like that suggestion, let's go for it.

ok I had a closer look: It turned out that there is no way of loading bundle entities for an already disabled module. It might use any storage controller, which we cannot use without having entity info in the system...

Thus, the only option to proceed I see is require entity-providing modules to care about that although we usually care about caring bundle attachers for them :(

I've opened #1330472: clean up entity-related data on module uninstall for solving the problem properly in d8.

Status:Active» Fixed
StatusFileSize
new5.65 KB

ok, I've implemented that for the testing module and added a note to this at the 'bundle of' key docs.

Committed patch attached.

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