class ConsoleExampleConfigureCommand

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/console_test/src/Command/ConsoleExampleConfigureCommand.php \Drupal\console_test\Command\ConsoleExampleConfigureCommand

An example command using configure() instead of the AsCommand attribute.

@internal

Hierarchy

Expanded class hierarchy of ConsoleExampleConfigureCommand

1 file declares its use of ConsoleExampleConfigureCommand
ConsoleTest.php in core/tests/Drupal/KernelTests/Core/Console/ConsoleTest.php

File

core/modules/system/tests/modules/console_test/src/Command/ConsoleExampleConfigureCommand.php, line 17

Namespace

Drupal\console_test\Command
View source
class ConsoleExampleConfigureCommand extends Command {
  
  /**
   * {@inheritdoc}
   */
  protected function configure() : void {
    $this->setName('example:command-configured');
  }
  
  /**
   * {@inheritdoc}
   */
  protected function execute(InputInterface $input, OutputInterface $output) : int {
    $io = new SymfonyStyle($input, $output);
    $io->success('Done with configured command.');
    return Command::SUCCESS;
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.