diff --git a/Console/Command/Import.php b/Console/Command/Import.php index 0bac4a2..c69ac0a 100644 --- a/Console/Command/Import.php +++ b/Console/Command/Import.php @@ -56,12 +56,16 @@ public function __construct( protected function execute( InputInterface $input, OutputInterface $output - ) { + ): int { $this->input = $input; $this->output = $output; - $this->state->setAreaCode('adminhtml'); + try { + $this->state->getAreaCode(); + } catch (\Magento\Framework\Exception\LocalizedException $e) { + $this->state->setAreaCode('adminhtml'); + } $csvRows = $this->readCsv(); @@ -73,6 +77,7 @@ protected function execute( $this->renderConversion($convertedRows); + return Command::SUCCESS; } protected function convertRows($csvRows){