From c619a8e0e0e9cd86d73fb9dccb5b81c99c91d78d Mon Sep 17 00:00:00 2001 From: Lorenzo Stramaccia Date: Thu, 19 Apr 2018 15:50:27 +0200 Subject: [PATCH] Fix constructor --- Command/ImportPage.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) 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')); }