{% extends "base/class.php.twig" %} {% block file_path %} \Drupal\{{extension}}\Command\{{ class }}. {% endblock %} {% block namespace_class %} namespace Drupal\{{extension}}\Command; {% endblock %} {% block use_class %} use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; {% if container_aware %} use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; {% else %} use Drupal\Console\Core\Command\Shared\CommandTrait; {% endif %} use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Annotations\DrupalCommand; {% endblock %} {% block class_declaration %} /** * Class {{ class_name }}. * * @package Drupal\{{extension}} * * @DrupalCommand ( * extension="{{extension}}", * extensionType="{{ extensionType }}" * ) */ class {{ class_name }} extends Command {% endblock %} {% block class_construct %} {% if services is not empty %} /** * Constructs a new {{ class_name }} object. */ public function __construct({{ servicesAsParameters(services)|join(', ') }}) { {{ serviceClassInitialization(services) }} parent::__construct(); } {% endif %} {% endblock %} {% block use_trait %} {% if container_aware %} use ContainerAwareCommandTrait; {% else %} use CommandTrait; {% endif %} {% endblock %} {% block class_methods %} /** * {@inheritdoc} */ protected function configure() { $this ->setName('{{ name }}') ->setDescription($this->trans('commands.{{ command_key }}.description')); } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $io->info($this->trans('commands.{{ command_key }}.messages.success')); } {%- endblock -%}