You are here

class ExportCommand in Configuration Split 8

Class ExportCommand.

@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 ExportCommand

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

File

src/Command/ExportCommand.php, line 22

Namespace

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

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

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

      // Make the magic happen.
      $this->cliService
        ->ioExport($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
ExportCommand::configure protected function
ExportCommand::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.