There is a Mage::reset() equivalent in Magento 2?
EDIT
The problem is:
I created a cli command that will create file to upload ebay listing... Here I got a foreach loop:
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
$areaObject = $this->_areaList->getArea(\Magento\Framework\App\Area::AREA_ADMINHTML);
$areaObject->load(\Magento\Framework\App\Area::PART_TRANSLATE);
----
foreach ($input->getOption(self::C_EBAY_STORES) as $ebaystore){
foreach ($input->getOption(self::C_EBAY_SITES) as $site){
$locale = $this->_helper->getLocale($site);
$this->_storeManagerInterface->setCurrentStore($locale['store']);
$this->_storeManagerInterface->getStore()->setCurrentCurrencyCode($locale['currency']);
$this->_coreSession->setCountryCode($locale['iso']);
$this->_emulation->startEnvironmentEmulation($this->_storeManagerInterface->getStore()->getCode(), 'frontend');
$collection = $this->getCollection($this->_helper->getEbayAttribute($ebaystore,$site));
foreach($collection as $product){
if($product->isSaleable()){
if(!in_array($product->getId(),$syncIds)){
$syncIds[] = $product->getId();
}
$product->load($product->getId());
$output->writeln("\t\t<info>SKU: ".$product->getSku()."</info>");
$output->writeln("\t\t<info>Minimal Price: ".print_r($product->getPriceInfo()->getPrice('final_price')->getAmount(),true)."</info>");
$output->writeln("\t\t<info>Core Session: ".print_r($this->_coreSession->getData(),true)."</info>");
$output->writeln("\t\t<comment>- - -</comment>");
}
}
$this->_emulation->stopEnvironmentEmulation();
}
}
The problem is thet txtRates ara calculated only at the beginning, but i ned to refresh it every time after $this->_coreSession->setCountryCode($locale['iso']);
to get the corrects rates for each country.
In Magento 1.9 i used this:
$locale = Mage::helper('ebaysync')->getLocale($site);
Mage::reset();
Mage::app()->setCurrentStore($locale['store']);
Mage::app()->getStore()->setCurrentCurrencyCode($locale['currency']);
Mage::getSingleton('core/session')->setCountryCode($locale['iso']);
but i can't find any solution for Magento 2;
Any help?