From f6045cef42e610e8be04d8434ea34e053b44889b Mon Sep 17 00:00:00 2001 From: "[OXID-PS] Keywan Ghadami" Date: Thu, 16 Jan 2020 14:54:38 +0100 Subject: [PATCH] fixig issue method not found --- src/Core/Application.php | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/Core/Application.php b/src/Core/Application.php index 1b4563b..dbfd5fb 100644 --- a/src/Core/Application.php +++ b/src/Core/Application.php @@ -119,13 +119,22 @@ public function loadBootstrap(InputInterface $input, OutputInterface $output) } /** - * @return \Symfony\Component\Console\Input\InputDefinition + * @param Command $command + * @param InputInterface $input + * @param OutputInterface $output + * @return int + * @throws Throwable */ - protected function getDefaultInputDefinition() + public function doRunCommand(Command $command, InputInterface $input, OutputInterface $output) { - $inputDefinition = parent::getDefaultInputDefinition(); - if (!$this->hasOption('shop') && !$this->hasShortcut('s')) { + if ($command->getDefinition()->hasShortcut('s') || $command->getDefinition()->hasOption('shop')) { + $logger = new ConsoleLogger($output); + $logger->critical('your command is using option shop or shortcut s which is already used by the console'); + } else { + //adding shop paramter to the definition so it is availible in the list command + //and can be used by commands + $inputDefinition = $this->getDefinition(); $inputDefinition->addOption( new InputOption( '--shop', @@ -136,24 +145,6 @@ protected function getDefaultInputDefinition() ); } - return $inputDefinition; - } - - /** - * @param Command $command - * @param InputInterface $input - * @param OutputInterface $output - * @return int - * @throws Throwable - */ - public function doRunCommand(Command $command, InputInterface $input, OutputInterface $output) - { - - //todo check if command wants to run for all shops - // oder instance of ShopAwareInterface then runthis command for every shop - //if (method_exists($command,'runMePerShop')){ - //foreach () - //} return parent::doRunCommand($command, $input, $output); }