Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / templates / module / src / Command / command.php.twig
index 7e6f264ddc2e91c820f230c60eea92855060a52d..0b16f4f5d244c09ddf46e8ea4c1c09ccccd0d179 100644 (file)
@@ -11,13 +11,11 @@ namespace Drupal\{{extension}}\Command;
 {% 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;
+use Drupal\Console\Core\Command\ContainerAwareCommand;
 {% else %}
-use Drupal\Console\Core\Command\Shared\CommandTrait;
+use Drupal\Console\Core\Command\Command;
 {% endif %}
-use Drupal\Console\Core\Style\DrupalStyle;
 use Drupal\Console\Annotations\DrupalCommand;
 {% endblock %}
 
@@ -25,14 +23,12 @@ use Drupal\Console\Annotations\DrupalCommand;
 /**
  * Class {{ class_name }}.
  *
- * @package Drupal\{{extension}}
- *
  * @DrupalCommand (
  *     extension="{{extension}}",
- *     extensionType="{{ extensionType }}"
+ *     extensionType="{{ extension_type }}"
  * )
  */
-class {{ class_name }} extends Command {% endblock %}
+class {{ class_name }} extends {% if container_aware %}ContainerAwareCommand{% else %}Command{% endif %} {% endblock %}
 {% block class_construct %}
 {% if services is not empty %}
 
@@ -46,15 +42,6 @@ class {{ class_name }} extends Command {% endblock %}
 {% endif %}
 {% endblock %}
 
-{% block use_trait %}
-{% if container_aware %}
-  use ContainerAwareCommandTrait;
-{% else %}
-  use CommandTrait;
-{% endif %}
-
-{% endblock %}
-
 {% block class_methods %}
   /**
    * {@inheritdoc}
@@ -65,12 +52,34 @@ class {{ class_name }} extends Command {% endblock %}
       ->setDescription($this->trans('commands.{{ command_key }}.description'));
   }
 
+{% if initialize %}
+ /**
+  * {@inheritdoc}
+  */
+  protected function initialize(InputInterface $input, OutputInterface $output) {
+    parent::initialize($input, $output);
+    $this->getIo()->info('initialize');
+  }
+
+{% endif %}
+{% if interact %}
+ /**
+  * {@inheritdoc}
+  */
+  protected function interact(InputInterface $input, OutputInterface $output) {
+    $this->getIo()->info('interact');
+  }
+
+{% endif %}
   /**
    * {@inheritdoc}
    */
   protected function execute(InputInterface $input, OutputInterface $output) {
-    $io = new DrupalStyle($input, $output);
-
-    $io->info($this->trans('commands.{{ command_key }}.messages.success'));
+    $this->getIo()->info('execute');
+    $this->getIo()->info($this->trans('commands.{{ command_key }}.messages.success'));
+{% if class_generator %}
+    $this->generator->generate([]);
+{% endif %}
   }
+
 {%- endblock -%}