示例#1
0
 /**
  * Handle scope row data
  *
  * @param string $type
  * @param array $row
  * @return boolean|Mage_Core_Model_Abstract
  */
 protected function _handleScopeRow($type, $row)
 {
     $previousScope = array();
     if ($this->isScopeLocal() && $this->getStorageData(self::STORAGE_KEY_SCOPE, self::SCOPE_SHARED) !== null) {
         $previousScope = $this->getStorageData(self::STORAGE_KEY_SCOPE, self::SCOPE_SHARED);
     }
     if (isset($previousScope[$type][$row[$type . '_id']])) {
         return false;
     }
     $scopeModel = Mage::getModel(self::$_scopeModelByType[$type]);
     $scopeModel->setData($row);
     // Change property for saving new objects with specified ids
     Mage_Utils_Reflection::setRestrictedPropertyValues($scopeModel->getResource(), array('_useIsObjectNew' => true, '_isPkAutoIncrement' => false));
     $scopeModel->isObjectNew(true);
     $scopeModel->save();
     // Revert changed property
     Mage_Utils_Reflection::setRestrictedPropertyValues($scopeModel->getResource(), array('_useIsObjectNew' => false, '_isPkAutoIncrement' => true));
     return $scopeModel;
 }