I have created a command for my module which calls a class Model/Importer from https://github.com/firegento/FireGento_FastSimpleImport2 extension. but i think it requires admin session.

I have tried to add area code by referring to this question 'Area code not set' issue in custom CLI commands in Magento 2

But still after clearing everything from var folder, i am getting the same exception.


1 Answer 1

#File: vendor/magento/framework/App/State.php

If you debug the above file,Magento\Framework\App\State object will only let you set a value once. As you know a command line scripts has no area.

Below code should pass the Area code not set exceptions.

When I was trying for the same, I did get the below working code from somewhere. It was working for me few days ago.

  public function __construct(
    \Magento\Framework\App\State $appState,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.