当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Core_Model_Abstract::setId方法代码示例

本文整理汇总了PHP中Mage_Core_Model_Abstract::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::setId方法的具体用法?PHP Mage_Core_Model_Abstract::setId怎么用?PHP Mage_Core_Model_Abstract::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Core_Model_Abstract的用法示例。


在下文中一共展示了Mage_Core_Model_Abstract::setId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _beforeSave

 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $connection = $this->_getWriteAdapter();
     $select = $connection->select()->from($this->getMainTable(), 'key_id')->where('string=?', $object->getString())->where('store_id=?', 0);
     $object->setId($connection->fetchOne($select));
     return parent::_beforeSave($object);
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:7,代码来源:String.php

示例2: _checkUnique

 /**
  * Validate unique configuration data before save
  * Set id to object if exists configuration instead of throw exception
  *
  * @param Mage_Core_Model_Config_Data $object
  * @return Mage_Core_Model_Resource_Config_Data
  */
 protected function _checkUnique(Mage_Core_Model_Abstract $object)
 {
     $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), array($this->getIdFieldName()))->where('scope = :scope')->where('scope_id = :scope_id')->where('path = :path');
     $bind = array('scope' => $object->getScope(), 'scope_id' => $object->getScopeId(), 'path' => $object->getPath());
     $configId = $this->_getReadAdapter()->fetchOne($select, $bind);
     if ($configId) {
         $object->setId($configId);
     }
     return $this;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:17,代码来源:Data.php

示例3: insertJoinedDatabase

 public function insertJoinedDatabase(Mage_Core_Model_Abstract $object)
 {
     $adapter = $this->_getWriteAdapter();
     $select = $adapter->select()->from($this->getMainTable(), array($this->getIdFieldName()))->where('program_id = ?', $object->getData('program_id'))->where('account_id = ?', $object->getData('account_id'));
     if ($adapter->fetchOne($select) === false) {
         $object->setId(null);
         $this->save($object);
     }
     return $this;
 }
开发者ID:billadams,项目名称:forever-frame,代码行数:10,代码来源:Joined.php

示例4: _cleanProductsCache

 /**
  * Clean cache by specified product and its ids
  *
  * @param Mage_Core_Model_Abstract $entity
  * @param array $ids
  */
 protected function _cleanProductsCache(Mage_Core_Model_Abstract $entity, array $ids)
 {
     $cacheTags = array();
     foreach ($ids as $entityId) {
         $entity->setId($entityId);
         $cacheTags = array_unique(array_merge($cacheTags, $entity->getCacheIdTagsWithCategories()));
     }
     if (!empty($cacheTags)) {
         Enterprise_PageCache_Model_Cache::getCacheInstance()->clean($cacheTags);
     }
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:17,代码来源:Index.php

示例5: _cleanEntityCache

 /**
  * Clean cache by specified entity and its ids
  *
  * @param Mage_Core_Model_Abstract $entity
  * @param array $ids
  */
 protected function _cleanEntityCache(Mage_Core_Model_Abstract $entity, array $ids)
 {
     $cacheTags = array();
     foreach ($ids as $entityId) {
         $entity->setId($entityId);
         $cacheTags = array_merge($cacheTags, $entity->getCacheIdTags());
     }
     if (!empty($cacheTags)) {
         Ves_Optimize_Model_Cache::getCacheInstance()->clean($cacheTags);
     }
 }
开发者ID:booklein,项目名称:bookle,代码行数:17,代码来源:Index.php

示例6: _beforeSave

 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getId() && $object->getStatus() == $object->getApprovedStatus()) {
         $searchTag = new Varien_Object();
         $this->loadByName($searchTag, $object->getName());
         if ($searchTag->getData($this->getIdFieldName()) && $searchTag->getStatus() == $object->getPendingStatus()) {
             $object->setId($searchTag->getData($this->getIdFieldName()));
         }
     }
     if (Mage::helper('core/string')->strlen($object->getName()) > 255) {
         $object->setName(Mage::helper('core/string')->substr($object->getName(), 0, 255));
     }
     return parent::_beforeSave($object);
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:14,代码来源:Tag.php

示例7: save

 public function save(Mage_Core_Model_Abstract $object)
 {
     $write = $this->_getWriteAdapter();
     $setId = $object->getId();
     $data = array('attribute_set_name' => $object->getAttributeSetName());
     $write->beginTransaction();
     try {
         if (intval($setId) > 0) {
             $condition = $write->quoteInto("{$this->getMainTable()}.{$this->getIdFieldName()} = ?", $setId);
             $write->update($this->getMainTable(), $data, $condition);
             if ($object->getGroups()) {
                 foreach ($object->getGroups() as $group) {
                     $group->save();
                 }
             }
             if ($object->getRemoveGroups()) {
                 foreach ($object->getRemoveGroups() as $group) {
                     $group->delete($group->getId());
                 }
             }
             if ($object->getRemoveAttributes()) {
                 foreach ($object->getRemoveAttributes() as $attribute) {
                     $attribute->deleteEntity();
                 }
             }
         } else {
             $data['entity_type_id'] = $object->getEntityTypeId();
             $write->insert($this->getMainTable(), $data);
             $object->setId($write->lastInsertId());
         }
         $write->commit();
     } catch (Exception $e) {
         $write->rollback();
         throw new Exception($e->getMessage());
     }
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:36,代码来源:Set.php

示例8: _beforeSave

 /**
  * Before save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Resource_Translate_String
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $adapter = $this->_getWriteAdapter();
     $select = $adapter->select()->from($this->getMainTable(), 'key_id')->where('string = :string')->where('store_id = :store_id');
     $bind = array('string' => $object->getString(), 'store_id' => Mage_Core_Model_App::ADMIN_STORE_ID);
     $object->setId($adapter->fetchOne($select, $bind));
     return parent::_beforeSave($object);
 }
开发者ID:Airmal,项目名称:Magento-Em,代码行数:14,代码来源:String.php

示例9: clearEntityCache

 /**
  * clearEntityCache
  *
  * @param Mage_Core_Model_Abstract $entity
  * @param array $ids
  * @return void
  */
 public function clearEntityCache(Mage_Core_Model_Abstract $entity, array $ids)
 {
     $cacheTags = array();
     foreach ($ids as $entityId) {
         $entity->setId($entityId);
         $cacheTags = array_merge($cacheTags, $entity->getCacheIdTags());
     }
     if (!empty($cacheTags)) {
         Enterprise_PageCache_Model_Cache::getCacheInstance()->clean($cacheTags);
     }
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:18,代码来源:Merchandiser.php

示例10: deleteModelSuccessfully

 /**
  * Callback for delete method in mocked model
  */
 public function deleteModelSuccessfully()
 {
     $this->_model->setId(null);
 }
开发者ID:nemphys,项目名称:magento2,代码行数:7,代码来源:EntityTest.php


注:本文中的Mage_Core_Model_Abstract::setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。