protected function execute(InputInterface $input, OutputInterface $output) { try { $sku = $input->getArgument('sku'); $this->productStatusAdapter->enableProductWithSku($sku); $output->writeln(sprintf('<info>Status of product "%s": enabled</info>', $sku)); } catch (\Exception $exception) { $output->writeln('<error>' . $exception->getMessage() . '</error>'); } }
/** * @param string $sku * @param string $status "enabled" or "disabled" * @return string */ public function set($sku, $status) { $this->validateStatus($status); if (ProductStatusAdapterInterface::ENABLED === $status) { $this->productStatusAdapter->enableProductWithSku($sku); } else { $this->productStatusAdapter->disableProductWithSku($sku); } return $status; }