You are here

public function EntityHierarchyCommands::hierarchyRebuildTree in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 src/Commands/EntityHierarchyCommands.php \Drupal\entity_hierarchy\Commands\EntityHierarchyCommands::hierarchyRebuildTree()

Rebuild tree.

@usage drush entity-hierarchy:rebuild-tree field_parents node Rebuild tree for node field named field_parents.

@command entity-hierarchy:rebuild-tree @aliases entity-hierarchy-rebuild-tree

Parameters

string $field_name: Field machine name

string $entity_type_id: Entity type id

File

src/Commands/EntityHierarchyCommands.php, line 44

Class

EntityHierarchyCommands
Drush commands.

Namespace

Drupal\entity_hierarchy\Commands

Code

public function hierarchyRebuildTree($field_name, $entity_type_id) {
  $tasks = $this->treeRebuilder
    ->getRebuildTasks($field_name, $entity_type_id);
  batch_set($tasks);
  $batch =& batch_get();
  $batch['progressive'] = FALSE;
  drush_backend_batch_process();
}