-
Notifications
You must be signed in to change notification settings - Fork 25
when bin/upgrade and bin/compile CLI error:Area code is not set #264
Comments
@Hayyan-Ebrahem I'll discuss this internally and see what the best solution is for this. Can you copy the issue to the new repo? https://github.com/Tweakwise/Magento2Tweakwise/ |
@Hayyan-Ebrahem We've discussed this internally. We are not planning to fix this on our end. The reasons for this are:
If you think we should fix this problem on our end, please explain why. We are open to an solution that doesn't supress the error in the admin. |
I think this problem should be fixed inside the Tweakwise module. It's bad practice to check the area code in the constructor. I've already made a fix and it's very simple and very clean. The only place you need to know the store id is inside the method "getStoreConfig". There you want to retrieve the config based on the request param store id in the admin url. For all other request you just want this to be NULL. When it's NULL the method \Magento\Framework\App\Config\ScopeConfigInterface::getValue will look up the current store id. So the best solution to fix this issue is to move the setting of the store id from the constructor to its own method. And then requesting that method inside "getStoreConfig" instead of directly looking at $this->storeId. Here's the patch that you could apply to make that work.
Hopefully you'll agree on this. If you have question, feel free to ask them. |
Thank you for the feedback and fix. If the problem can be fixed bij removing it from the constructor, than thats sounds like an excellent solution for this. I'll test this and implement the solution if everything works like it should. |
@jasperzeinstra @Hayyan-Ebrahem Fixed in version 5.0.4 in the tweakwise/magento2tweakwise repo. |
Environment
Steps to reproduce
. bin/magento setup:upgrade | bin/magento setup:di:compile;
Actual result
Area code is not set
In State.php line 153:
the cause of the error is in vendor/emico/tweakwise/Model/Config.php:100 AreaCode needs to be set
The text was updated successfully, but these errors were encountered: