inline_entity_form.module contains the following:

/**
 * Implements hook_entity_delete().
 *
 * Deletes referenced entities if needed.
 *
 * @todo Remove when there's a stable contrib module for this.
 */
function inline_entity_form_entity_delete($entity, $type) {

I agree and think this functionality is not specific to inline_entity_form at all. So I wrote http://drupal.org/project/field_referenced_delete which works out of the box with entityreference fields, and should eventually support any fields that use the 'foreign keys' in hook_field_schema() correctly.

Comments

bojanz’s picture

Awesome, just what the doctor ordered.

I need to:
1) Confirm that the module works for product reference and line item reference fields, and add support if it is missing.
2) Add the module to Kickstart
3) Commit your patch.

So #1 is my main blocker and I will try to get to that soon.

Dave Reid’s picture

Great. I tested that the module's API supports product reference fields, so I assume line items would work as well. It would be good to have someone more comfortable with those fields to actually test it and make sure the functionality works too.

Dave Reid’s picture

Just fixed a bug in 7.x-1.x that made the module's settings not show up for fields that don't actually have any settings, which affected line item reference fields. But fixed now.