When an entity is being deleted the related flagging records are deleted in bulk by _flag_entity_delete(), but other modules are not notified about this. For example, we had some custom notifications related to flagging_ids and we ended up with broken notifications when some flagging entities couldn't be loaded.
See the existing hooks invoke in flag_flag::flagging_delete(), we need something similar.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ehegedus’s picture

Status: Active » Needs review
FileSize
1.44 KB

Hook implementation we used to fix our issues.

joachim’s picture

Thanks for the patch!

Unfortunately, this is an area of Flag that's currently not really working properly -- see #2052947: deleting a Flagging via deleting an entity does not delete Flagging fields data. When that issue is fixed, it's likely to to throw off the patch here. Also, it would probably mean it's not needed, as hook_flag_unflag() would get invoked properly.

(BTW, please don't use random tags on issues.)