Respond to entity deletion.
This hook runs after the entity type-specific delete hook.
Drupal\Core\Entity\EntityInterface $entity: The entity object for the entity that has been deleted.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_entity_delete(Drupal\Core\Entity\EntityInterface $entity) {
// Delete the entity's entry from a fictional table of all entities.
db_delete('example_entity')
->condition('type', $entity
->entityType())
->condition('id', $entity
->id())
->execute();
}