Command/SyncStorageCreateCommand.php
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $storage = $input->getArgument('storage');
        $shopId = $input->getOption('shop-id');

        // Do not convert null value to integer, because null value is fully acceptable for required method.
        if ($shopId !== null) {
            $shopId = (int)$shopId;
        }

        switch ($storage) {
            case SyncStorage::STORAGE_MYSQL:
                /** @var Connection $connection */
                $connection = $this->getContainer()->get('doctrine.dbal.default_connection');
                /** @var StorageManagerInterface $storageManager */
                $storageManager = $this->getContainer()
                    ->get('ongr_connections.sync.storage_manager.mysql_storage_manager');
                break;
            default:
                throw new InvalidArgumentException('Storage "' . $storage . '" is not implemented yet.');
        }

        $result = $storageManager->createStorage($shopId, $connection);

        if ($result === null) {
            $output->writeln('<info>Storage for ' . $storage . ' already exists.</info>');
        } elseif ($result === true) {
            $output->writeln('<info>Storage successfully created for ' . $storage . '.</info>');
        } else {
            $output->writeln('<error>Failed to create storage for ' . $storage . '.</error>');
        }
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $storage = $input->getArgument('storage');
        $shopId = $input->getOption('shop-id');

        // Do not convert null value to integer, because null value is fully acceptable for required method.
        if ($shopId !== null) {
            $shopId = (int)$shopId;
        }

        switch ($storage) {
            case SyncStorage::STORAGE_MYSQL:
                /** @var Connection $connection */
                $connection = $this->getContainer()->get('doctrine.dbal.default_connection');
                /** @var StorageManagerInterface $storageManager */
                $storageManager = $this->getContainer()
                    ->get('ongr_connections.sync.storage_manager.mysql_storage_manager');
                break;
            default:
                throw new InvalidArgumentException('Storage "' . $storage . '" is not implemented yet.');
        }

        $result = $storageManager->createStorage($shopId, $connection);

        if ($result === null) {
            $output->writeln('<info>Storage for ' . $storage . ' already exists.</info>');
        } elseif ($result === true) {
            $output->writeln('<info>Storage successfully created for ' . $storage . '.</info>');
        } else {
            $output->writeln('<error>Failed to create storage for ' . $storage . '.</error>');
        }
    }
{@inheritdoc}