/** * @param string $sku */ private function enableProductWithSku($sku) { try { $this->productStatusAdapter->enableProductWithSku($sku); } catch (ProductAlreadyEnabledException $exception) { } }
protected function execute(InputInterface $input, OutputInterface $output) { try { $sku = $input->getArgument('sku'); $this->productStatusAdapter->enableProductWithSku($sku); $output->writeln(sprintf('<info>Enabled product "%s"</info>', $sku)); } catch (ProductStatusAdapterException $exception) { $output->writeln('<error>' . $exception->getMessage() . '</error>'); } }