Unverified Commit 53e3fa0a authored by Jake Bell's avatar Jake Bell Committed by Lee Rowlands
Browse files

Issue #3272755 by jacobbell84: Entity Deletes don't follow the same tracking rules

parent 144f0f14
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
 */

use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\taxonomy\TermInterface;
@@ -25,11 +26,13 @@ function taxonomy_entity_index_field_config_delete(FieldConfig $instance) {
 * Implements hook_entity_delete().
 */
function taxonomy_entity_index_entity_delete(EntityInterface $entity) {
  if ($entity instanceOf ContentEntityInterface) {
    \Drupal::database()->delete('taxonomy_entity_index')
      ->condition('entity_type', $entity->getEntityTypeId())
      ->condition('entity_id', $entity->id())
      ->execute();
  }
}

/**
 * Implements hook_ENTITY_TYPE_delete().