Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Generate / EntityCommand.php
index d5869edc7b75b70341b4dde771dc224d6332ffc9..eb88c0e0786e6c5d7104d63dd2152dd654879171 100644 (file)
@@ -10,14 +10,11 @@ namespace Drupal\Console\Command\Generate;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Command\Command;
+use Drupal\Console\Core\Command\Command;
 use Drupal\Console\Command\Shared\ModuleTrait;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
 
 abstract class EntityCommand extends Command
 {
-    use CommandTrait;
     use ModuleTrait;
     private $entityType;
     private $commandName;
@@ -97,23 +94,16 @@ abstract class EntityCommand extends Command
      */
     protected function interact(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
-
         $commandKey = str_replace(':', '.', $this->commandName);
         $utils = $this->stringConverter;
 
         // --module option
-        $module = $input->getOption('module');
-        if (!$module) {
-            // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion
-            $module = $this->moduleQuestion($io);
-            $input->setOption('module', $module);
-        }
+        $this->getModuleOption();
 
         // --entity-class option
         $entityClass = $input->getOption('entity-class');
         if (!$entityClass) {
-            $entityClass = $io->ask(
+            $entityClass = $this->getIo()->ask(
                 $this->trans('commands.'.$commandKey.'.questions.entity-class'),
                 'DefaultEntity',
                 function ($entityClass) {
@@ -127,7 +117,7 @@ abstract class EntityCommand extends Command
         // --entity-name option
         $entityName = $input->getOption('entity-name');
         if (!$entityName) {
-            $entityName = $io->ask(
+            $entityName = $this->getIo()->ask(
                 $this->trans('commands.'.$commandKey.'.questions.entity-name'),
                 $utils->camelCaseToMachineName($entityClass),
                 function ($entityName) {
@@ -140,7 +130,7 @@ abstract class EntityCommand extends Command
         // --label option
         $label = $input->getOption('label');
         if (!$label) {
-            $label = $io->ask(
+            $label = $this->getIo()->ask(
                 $this->trans('commands.'.$commandKey.'.questions.label'),
                 $utils->camelCaseToHuman($entityClass)
             );
@@ -152,7 +142,7 @@ abstract class EntityCommand extends Command
         if (!$base_path) {
             $base_path = $this->getDefaultBasePath();
         }
-        $base_path = $io->ask(
+        $base_path = $this->getIo()->ask(
             $this->trans('commands.'.$commandKey.'.questions.base-path'),
             $base_path
         );