<?php declare(strict_types=1); /* * This file is part of vonRotenberg WMFGO Cevisio Bundle. * * (c) vonRotenberg * * @license proprietary */ namespace vonRotenberg\WmfgoCevisioBundle\Command; use Contao\CoreBundle\Framework\ContaoFramework; use Contao\System; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use vonRotenberg\WmfgoCevisioBundle\Cron\ShopwareImportProductsJob; class ShopwareImportProductsCommand extends Command { protected static $defaultName = 'shopware:import-products'; /** * @var ContaoFramework */ private $framework; public function __construct(ContaoFramework $framework) { $this->framework = $framework; parent::__construct(); } protected function configure(): void { $this ->setName(self::$defaultName) ->setDescription('Import products in Shopware instance') ; } protected function execute(InputInterface $input, OutputInterface $output): int { $this->framework->initialize(); $io = new SymfonyStyle($input, $output); $io->title('Product import to Shopware'); /** @var ShopwareImportProductsJob $import */ $import = System::getContainer()->get(ShopwareImportProductsJob::class); $import->import('cli', $io); return 0; } }