class EntityHierarchyCommands in Entity Reference Hierarchy 8.2
Same name and namespace in other branches
- 3.x src/Commands/EntityHierarchyCommands.php \Drupal\entity_hierarchy\Commands\EntityHierarchyCommands
 
Drush commands.
Hierarchy
- class \Drupal\entity_hierarchy\Commands\EntityHierarchyCommands extends \Drush\Commands\DrushCommands
 
Expanded class hierarchy of EntityHierarchyCommands
1 string reference to 'EntityHierarchyCommands'
1 service uses EntityHierarchyCommands
File
- src/
Commands/ EntityHierarchyCommands.php, line 10  
Namespace
Drupal\entity_hierarchy\CommandsView source
class EntityHierarchyCommands extends DrushCommands {
  /**
   * TreeRebuilder instance.
   *
   * @var \Drupal\entity_hierarchy\Storage\TreeRebuilder
   */
  protected $treeRebuilder;
  /**
   * EntityHierarchyCommands constructor.
   *
   * @param \Drupal\entity_hierarchy\Storage\TreeRebuilder $treeRebuilder
   */
  public function __construct($treeRebuilder) {
    parent::__construct();
    $this->treeRebuilder = $treeRebuilder;
  }
  /**
   * Rebuild tree.
   *
   * @param string $field_name
   *   Field machine name
   * @param string $entity_type_id
   *   Entity type id
   *
   * @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
   */
  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();
  }
}Members
| 
            Name | 
                  Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 
            EntityHierarchyCommands:: | 
                  protected | property | TreeRebuilder instance. | |
| 
            EntityHierarchyCommands:: | 
                  public | function | Rebuild tree. | |
| 
            EntityHierarchyCommands:: | 
                  public | function | EntityHierarchyCommands constructor. |