protected function VocabularyStorageController::preDelete

Overrides Drupal\Core\Config\Entity\ConfigStorageController::preDelete().

Overrides ConfigStorageController::preDelete

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php, line 53
Definition of Drupal\taxonomy\VocabularyStorageController.

Class

VocabularyStorageController
Defines a controller class for taxonomy vocabularies.

Namespace

Drupal\taxonomy

Code

protected function preDelete($entities) {
  parent::preDelete($entities);

  // Only load terms without a parent, child terms will get deleted too.
  $tids = db_query('SELECT t.tid FROM {taxonomy_term_data} t INNER JOIN {taxonomy_term_hierarchy} th ON th.tid = t.tid WHERE t.vid IN (:vids) AND th.parent = 0', array(
    ':vids' => array_keys($entities),
  ))
    ->fetchCol();
  entity_delete_multiple('taxonomy_term', $tids);
}