Skip to content

Commit

Permalink
Fix constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
slackerzz committed Apr 19, 2018
1 parent ec5211b commit c619a8e
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions Command/ImportPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}

Expand All @@ -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'));
}

Expand Down

0 comments on commit c619a8e

Please sign in to comment.