forked from hechoendrupal/drupal-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMigrateDebugCommand.php
More file actions
54 lines (43 loc) · 1.66 KB
/
Copy pathMigrateDebugCommand.php
File metadata and controls
54 lines (43 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @file
* Contains \Drupal\AppConsole\Command\MigrateDebugCommand.
*/
namespace Drupal\AppConsole\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class MigrateDebugCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName('migrate:debug')
->setDescription($this->trans('commands.migrate.debug.description'))
->addArgument('drupal-version', InputArgument::OPTIONAL,
$this->trans('commands.migrate.debug.arguments.drupal-version'));
$this->addDependency('migrate');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$drupal_version = $input->getArgument('drupal-version');
$table = $this->getHelperSet()->get('table');
$table->setlayout($table::LAYOUT_COMPACT);
$this->getAllMigrations($drupal_version, $output, $table);
}
protected function getAllMigrations($drupal_version, $output, $table)
{
$migrations = $this->getMigrations($drupal_version);
$table->setHeaders(
[
$this->trans('commands.migrate.debug.messages.id'),
$this->trans('commands.migrate.debug.messages.description'),
$this->trans('commands.migrate.debug.messages.version'),
]);
$table->setlayout($table::LAYOUT_COMPACT);
foreach ($migrations as $migration_id => $migration) {
$table->addRow([$migration_id, $migration['description'], $migration['version']]);
}
$table->render($output);
}
}