예제 #1
0
파일: Db.php 프로젝트: aiesh/magento2
 /**
  * Retrieve application store object
  *
  * @param null|string|bool|int|Store $storeId
  * @return Store
  * @throws \Magento\Store\Model\Exception
  */
 public function getStore($storeId = null)
 {
     if ($this->_appState->getUpdateMode()) {
         return $this->_getDefaultStore();
     }
     if ($storeId === true && $this->hasSingleStore()) {
         return $this->_store;
     }
     if (!isset($storeId) || '' === $storeId || $storeId === true) {
         $storeId = $this->_currentStore;
     }
     if ($storeId instanceof Store) {
         return $storeId;
     }
     if (empty($this->_stores[$storeId])) {
         $store = $this->_storeFactory->create();
         if (is_numeric($storeId)) {
             $store->load($storeId);
         } elseif (is_string($storeId)) {
             $store->load($storeId, 'code');
         }
         if (!$store->getCode()) {
             throw new \Magento\Store\Model\Exception('Store Manager has been initialized not properly');
         }
         $this->_stores[$store->getStoreId()] = $store;
         $this->_stores[$store->getCode()] = $store;
     }
     return $this->_stores[$storeId];
 }
예제 #2
0
 public function testSetGetUpdateMode()
 {
     $this->assertFalse($this->model->getUpdateMode());
     $this->model->setUpdateMode(true);
     $this->assertTrue($this->model->getUpdateMode());
 }