You are here

public function Manager::clearDepths in Taxonomy Term Depth 8

Same name and namespace in other branches
  1. 8.2 src/QueueManager/Manager.php \Drupal\taxonomy_term_depth\QueueManager\Manager::clearDepths()
1 call to Manager::clearDepths()
Manager::queueByIds in src/QueueManager/Manager.php

File

src/QueueManager/Manager.php, line 98
Manages queue operations.

Class

Manager

Namespace

Drupal\taxonomy_term_depth\QueueManager

Code

public function clearDepths($ids = NULL) {
  $query = \Drupal::database()
    ->update('taxonomy_term_field_data');
  $query
    ->fields([
    'depth_level' => NULL,
    'depth' => NULL,
  ]);
  if ($this->vid !== NULL) {
    $query
      ->condition('vid', $this->vid);
  }
  if ($ids !== NULL && is_array($ids) && !empty($ids)) {
    $query
      ->condition('tid', $ids, 'IN');
  }
  return $query
    ->execute();
}