Overrides Drupal\Core\Config\Entity\ConfigStorageController::preDelete().
Overrides ConfigStorageController::preDelete
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);
}