9 use Symfony\Component\Console\Helper\Table;
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
12 use Symfony\Component\Console\Command\Command;
29 \
Magento\Store\Api\WebsiteRepositoryInterface $websiteManagement
31 $this->manager = $websiteManagement;
32 parent::__construct();
40 $this->setName(
'store:website:list')
41 ->setDescription(
'Displays the list of websites');
53 $table->setHeaders([
'ID',
'Default Group Id',
'Name',
'Code',
'Sort Order',
'Is Default']);
55 foreach ($this->manager->getList() as
$website) {
68 return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
69 }
catch (\Exception $e) {
70 $output->writeln(
'<error>' . $e->getMessage() .
'</error>');
71 if (
$output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
72 $output->writeln($e->getTraceAsString());
75 return \Magento\Framework\Console\Cli::RETURN_FAILURE;
__construct(\Magento\Store\Api\WebsiteRepositoryInterface $websiteManagement)
execute(InputInterface $input, OutputInterface $output)