protected function listDeps()
{
$deps = $this->dependency->resolveDependencyList($this->argument('table_name'));
$name_lengths = [];
$from_lengths = [];
$to_lengths = [];
foreach ($deps as $dep) {
$from_table = $dep['from_table'];
$to_table = $dep['to_table'];
$from_field = $dep['from_field'];
$to_field = $dep['to_field'];
$name_lengths[] = strlen($to_table);
$from_lengths[] = strlen($from_table) + strlen($from_field) + 1;
$to_lengths[] = strlen($to_table) + strlen($to_field) + 1;
}
$max_name = max($name_lengths);
$max_from = max($from_lengths);
$max_to = max($to_lengths);
foreach ($deps as $dep) {
$from_table = $dep['from_table'];
$to_table = $dep['to_table'];
$from_field = $dep['from_field'];
$to_field = $dep['to_field'];
$table = str_pad($to_table, $max_name);
$from = str_pad("{$from_table}.{$from_field}", $max_from, ' ', STR_PAD_LEFT);
$to = str_pad("{$to_table}.{$to_field}", $max_to);
if ($this->option('relations')) {
$this->line("- {$table} | {$from} --> {$to}");
} else {
$this->line("- {$table}");
}
}
}