Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Database / QueryCommand.php
index d5ee1139e16ed5070cc4a1a72b87bf1e8eb4e035..0658acbaaa67e348e286664b11be3a72bffe2d3a 100644 (file)
@@ -17,15 +17,12 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Process\ProcessBuilder;
-use Symfony\Component\Console\Command\Command;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
+use Drupal\Console\Core\Command\Command;
 use Drupal\Console\Command\Shared\ConnectTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
 
 class QueryCommand extends Command
 {
     use ConnectTrait;
-    use CommandTrait;
 
     /**
      * {@inheritdoc}
@@ -54,7 +51,8 @@ class QueryCommand extends Command
             ->addOption('vertical', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.vertical'))
             ->addOption('batch', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.batch'))
 
-            ->setHelp($this->trans('commands.database.query.help'));
+            ->setHelp($this->trans('commands.database.query.help'))
+            ->setAliases(['dbq']);
     }
 
     /**
@@ -62,13 +60,11 @@ class QueryCommand extends Command
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
-
         $query = $input->getArgument('query');
         $database = $input->getArgument('database');
         $learning = $input->getOption('learning');
 
-        $databaseConnection = $this->resolveConnection($io, $database);
+        $databaseConnection = $this->resolveConnection($database);
 
         $connection = sprintf(
             '%s -A --database=%s --user=%s --password=%s --host=%s --port=%s',
@@ -115,7 +111,7 @@ class QueryCommand extends Command
         );
 
         if ($learning) {
-            $io->commentBlock(
+            $this->getIo()->commentBlock(
                 implode(" ", $args)
             );
         }