コード例 #1
0
 /**
  * @param GetResponseEvent $event
  */
 public function onKernelRequestSetStore(GetResponseEvent $event)
 {
     if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType() && $this->app) {
         $store = $this->storeResolver->resolve($event->getRequest());
         if (false !== $store) {
             // keep default store in case manual override fails
             $defaultStore = $this->app->getStore()->getCode();
             $this->app->setCurrentStore($store);
             try {
                 // try to load the store
                 $this->app->getStore();
             } catch (\Mage_Core_Model_Store_Exception $e) {
                 $this->app->setCurrentStore($defaultStore);
             }
         }
     }
 }
コード例 #2
0
ファイル: Emulation.php プロジェクト: okite11/frames21
 /**
  * Stop enviromment emulation
  *
  * Function restores initial store environment
  *
  * @param Varien_Object $initialEnvironmentInfo information about environment of the initial store
  *
  * @return Mage_Core_Model_App_Emulation
  */
 public function stopEnvironmentEmulation(Varien_Object $initialEnvironmentInfo)
 {
     $this->_restoreInitialInlineTranslation($initialEnvironmentInfo->getInitialTranslateInline());
     $initialDesign = $initialEnvironmentInfo->getInitialDesign();
     $this->_restoreInitialDesign($initialDesign);
     // Current store needs to be changed right before locale change and after design change
     $this->_app->setCurrentStore($initialDesign['store']);
     $this->_restoreInitialLocale($initialEnvironmentInfo->getInitialLocaleCode(), $initialDesign['area']);
     return $this;
 }
コード例 #3
0
ファイル: AppTest.php プロジェクト: nemphys/magento2
 public function testSetCurrentStore()
 {
     $store = new Mage_Core_Model_Store();
     $this->_model->setCurrentStore($store);
     $this->assertSame($store, $this->_model->getStore());
 }