You are here

public function TermStorage::updateParentHierarchy in Multiversion 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Storage/Sql/TermStorage.php \Drupal\multiversion\Entity\Storage\Sql\TermStorage::updateParentHierarchy()

Updates terms hierarchy information for the children when terms are deleted.

Parameters

array $tids: Array of terms that need to be removed from hierarchy.

1 call to TermStorage::updateParentHierarchy()
TermStorage::delete in src/Entity/Storage/Sql/TermStorage.php
Deletes permanently saved entities.

File

src/Entity/Storage/Sql/TermStorage.php, line 150

Class

TermStorage
Storage handler for taxonomy terms.

Namespace

Drupal\multiversion\Entity\Storage\Sql

Code

public function updateParentHierarchy($tids) {
  $table = 'taxonomy_term__parent';
  $field = 'parent_target_id';
  if (floatval(\Drupal::VERSION) < 8.6) {
    $table = 'taxonomy_term_hierarchy';
    $field = 'parent';
  }
  $this->database
    ->update($table)
    ->condition($field, $tids, 'IN')
    ->fields([
    $field => 0,
  ])
    ->execute();
}