You are here

protected function MigrateToolsCommands::printDependencies in Migrate Tools 8.5

Prints the dependencies of a single migration in the dependency tree.

Helper for dependencyTree().

Parameters

int $level: The current level in the tree.

string $prefix: The prefix for the current level's lines.

array $dependency_graph: The complete dependency graph.

string $migration_name: The name of the migration to print dependencies for.

1 call to MigrateToolsCommands::printDependencies()
MigrateToolsCommands::dependencyTree in src/Commands/MigrateToolsCommands.php
Shows a tree of migration dependencies.

File

src/Commands/MigrateToolsCommands.php, line 160

Class

MigrateToolsCommands
Migrate Tools drush commands.

Namespace

Drupal\migrate_tools\Commands

Code

protected function printDependencies($level, $prefix, $dependency_graph, $migration_name) {
  $last_edge = end($dependency_graph[$migration_name]['edges']);
  foreach ($dependency_graph[$migration_name]['edges'] as $edge) {
    if ($edge === $last_edge) {
      $tree_string = '└──';
      $subtree_prefix = $prefix . '   ';
    }
    else {
      $tree_string = '├──';
      $subtree_prefix = $prefix . '│  ';
    }
    $this
      ->output()
      ->writeln($prefix . $tree_string . $edge);
    $this
      ->printDependencies($level + 1, $subtree_prefix, $dependency_graph, $edge);
  }
}