Skip to content

Commit

Permalink
fixig issue method not found
Browse files Browse the repository at this point in the history
  • Loading branch information
keywan-ghadami-oxid authored Jan 16, 2020
1 parent 6fe1cf1 commit f6045ce
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions src/Core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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);
}

Expand Down

0 comments on commit f6045ce

Please sign in to comment.