mirasvit / module-profiler

Magento 2 Profiler
https://mirasvit.com/
Open Software License 3.0
133 stars 36 forks source link

Area code "empty" does not exist #10

Closed ghost closed 7 years ago

ghost commented 7 years ago

I have made the following changes to the enble command:

file: ../magento2ce/vendor/mirasvit/module-profiler/src/Profiler/Console/Command/EnableCommand.php

line 42: $this->appState->setAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND);

Running: Magento ver. 2.2.0-dev

Tantuss commented 7 years ago

This makes it impossible to use in case you have Magento 2.1.7.

I get an error on the command line: [Magento\Framework\Exception\LocalizedException] Area code is already set

After commenting out this code: $this->appState->setAreaCode('empty');

The issue did go away.

So maybe to replace it to something like this: if(empty($this->appState->getAreaCode())) $this->appState->setAreaCode('empty');