this is the error.
Fatal error: Uncaught MagentoFrameworkExceptionLocalizedException: Area code is not set in /var/www/html/magento22/vendor/magento/framework/App/State.php:152 Stack trace: #0 /var/www/html/magento22/vendor/magento/framework/Session/SessionManager.php(173): MagentoFrameworkAppState->getAreaCode() #1 /var/www/html/magento22/generated/code/Magento/Framework/Session/Generic/Interceptor.php(50): MagentoFrameworkSessionSessionManager->start() #2 /var/www/html/magento22/vendor/magento/framework/Session/SessionManager.php(130): MagentoFrameworkSessionGenericInterceptor->start() #3 /var/www/html/magento22/generated/code/Magento/Framework/Session/Generic/Interceptor.php(14): MagentoFrameworkSessionSessionManager->__construct(Object(MagentoFrameworkAppRequestHttp), Object(MagentoFrameworkSessionSidResolverProxy), Object(MagentoFrameworkSessionConfig), Object(MagentoFrameworkSessionSaveHandler), Object(MagentoFrameworkSessionValidator), Object(MagentoFrameworkSessionStorage), Object(MagentoFramewor in /var/www/html/magento22/vendor/magento/framework/Session/SessionManager.php on line 175
this is the code .I am converting Mage::getModel(‘sales/order’); in magento 2
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$orders = $objectManager->get('MagentoSalesModelOrder')
how to deal with this?
2
Answers
Thank you for your answers. I found solution so want to share it. Add this line
before
To convert
Mage::getModel('sales/order');
inmagento2
you can use following code