You are here

class ImportCommand in Configuration Split 8

Class ImportCommand.

@package Drupal\config_split

@DrupalCommand ( extension="config_split", extensionType="module" )

Hierarchy

  • class \Drupal\config_split\Command\SplitCommandBase extends \Drupal\Console\Core\Command\Command

Expanded class hierarchy of ImportCommand

1 string reference to 'ImportCommand'
console.services.yml in ./console.services.yml
console.services.yml
1 service uses ImportCommand
config_split.config_split_import in ./console.services.yml
Drupal\config_split\Command\ImportCommand

File

src/Command/ImportCommand.php, line 22

Namespace

Drupal\config_split\Command
View source
class ImportCommand extends SplitCommandBase {

  /**
   * {@inheritdoc}
   */
  protected function configure() {
    $this
      ->setName('config_split:import')
      ->setAliases([
      'csim',
    ])
      ->setDescription($this
      ->trans('commands.config_split.import.description'))
      ->addOption('split', NULL, InputOption::VALUE_OPTIONAL);
  }

  /**
   * {@inheritdoc}
   */
  protected function execute(InputInterface $input, OutputInterface $output) {
    try {

      // Make the magic happen.
      $this->cliService
        ->ioImport($input
        ->getOption('split'), $this
        ->getIo(), [
        $this,
        't',
      ], $input
        ->getOption('yes'));
    } catch (\Exception $e) {
      $this
        ->getIo()
        ->error($e
        ->getMessage());
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ImportCommand::configure protected function
ImportCommand::execute protected function
SplitCommandBase::$cliService protected property The cli service doing all the work.
SplitCommandBase::t public function The translation function akin to Drupal's t().
SplitCommandBase::__construct public function Constructor with cli service injection.