use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Drupal\Console\Command\Shared\MigrationTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
use Drupal\Console\Annotations\DrupalCommand;
-use Symfony\Component\Console\Command\Command;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
+use Drupal\Console\Core\Command\Command;
use Drupal\migrate_plus\Entity\MigrationGroup;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutable;
* extensionType = "module"
* )
*/
-
class RollBackCommand extends Command
{
use MigrationTrait;
- use CommandTrait;
/**
* @var MigrationPluginManagerInterface $pluginManagerMigration
*
* @param MigrationPluginManagerInterface $pluginManagerMigration
*/
- public function __construct(MigrationPluginManagerInterface $pluginManagerMigration)
- {
+ public function __construct(
+ MigrationPluginManagerInterface $pluginManagerMigration
+ ) {
$this->pluginManagerMigration = $pluginManagerMigration;
parent::__construct();
}
'source-base_path',
null,
InputOption::VALUE_OPTIONAL,
- $this->trans('commands.migrate.setup.options.source-base_path')
- );
+ $this->trans('commands.migrate.setup.options.source-base-path')
+ )->setAliases(['mir']);
+ ;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
-
$sourceBasepath = $input->getOption('source-base_path');
$configuration['source']['constants']['source_base_path'] = rtrim($sourceBasepath, '/') . '/';
// --migration-id prefix
foreach ($migration_ids as $migration) {
if (!in_array($migration, $migrations_list)) {
- $io->warning(
+ $this->getIo()->warning(
sprintf(
$this->trans('commands.migrate.rollback.messages.not-available'),
$migration
$migration_status = $executable->rollback();
switch ($migration_status) {
case MigrationInterface::RESULT_COMPLETED:
- $io->info(
+ $this->getIo()->info(
sprintf(
$this->trans('commands.migrate.rollback.messages.processing'),
$migration
);
break;
case MigrationInterface::RESULT_INCOMPLETE:
- $io->info(
+ $this->getIo()->info(
sprintf(
$this->trans('commands.migrate.execute.messages.importing-incomplete'),
$migration
);
break;
case MigrationInterface::RESULT_STOPPED:
- $io->error(
+ $this->getIo()->error(
sprintf(
$this->trans('commands.migrate.execute.messages.import-stopped'),
$migration
*/
protected function interact(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
// Get migrations
$migrations_list = $this->getMigrations($version_tag);
$migrations_ids = [];
while (true) {
- $migration_id = $io->choiceNoList(
+ $migration_id = $this->getIo()->choiceNoList(
$this->trans('commands.migrate.execute.questions.id'),
array_keys($migrations_list),
'all'
// --source-base_path
$sourceBasepath = $input->getOption('source-base_path');
if (!$sourceBasepath) {
- $sourceBasepath = $io->ask(
- $this->trans('commands.migrate.setup.questions.source-base_path'),
+ $sourceBasepath = $this->getIo()->ask(
+ $this->trans('commands.migrate.setup.questions.source-base-path'),
''
);
$input->setOption('source-base_path', $sourceBasepath);