diff --git a/Command/ImportPage.php b/Command/ImportPage.php index 2c526d9..8ec9349 100644 --- a/Command/ImportPage.php +++ b/Command/ImportPage.php @@ -20,6 +20,7 @@ namespace MSP\CmsImportExport\Command; +use Magento\Framework\ObjectManagerInterface; use MSP\CmsImportExport\Api\ContentInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; @@ -29,11 +30,19 @@ class ImportPage extends Command { protected $pageInterface; + /** + * @var ObjectManagerInterface + */ + private $objectManager; + /** + * ImportPage constructor. + * @param ObjectManagerInterface $objectManager + */ public function __construct( - ContentInterface $contentInterface + ObjectManagerInterface $objectManager ) { - $this->contentInterface = $contentInterface; + $this->objectManager = $objectManager; parent::__construct(); } @@ -46,10 +55,18 @@ protected function configure() parent::configure(); } + /** + * @param InputInterface $input + * @param OutputInterface $output + * @return int|null|void + * @throws \Exception + */ protected function execute(InputInterface $input, OutputInterface $output) { + $contentInterface = $this->objectManager->get(ContentInterface::class); + $zipFile = $input->getArgument('zipfile'); - if ($this->contentInterface->importFromZipFile($zipFile, false) == 0) { + if ($contentInterface->importFromZipFile($zipFile, false) == 0) { throw new \Exception(__('Archive is empty')); }