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


PHP Mage_Core_Model_Abstract::getCode方法代码示例

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


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

示例1: save

 /**
  * Save Object code
  *
  * @param Mage_Core_Model_Abstract $object
  *
  * @return $this
  */
 public function save(Mage_Core_Model_Abstract $object)
 {
     $adapter = $this->_getWriteAdapter();
     if ($object->getImport() && $object->getCode() && $object->getEntityId()) {
         $values = array('import' => $object->getImport(), 'code' => $object->getCode(), 'entity_id' => $object->getEntityId());
         $adapter->insertOnDuplicate($this->getMainTable(), $values, array('entity_id'));
     } else {
         Mage::throwException(Mage::helper('pimgento_core')->__('Error between PIM code and Magento entity'));
     }
     return $this;
 }
开发者ID:techpub,项目名称:PIMGento,代码行数:18,代码来源:Code.php

示例2: _beforeSave

 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     /** @var  Mirasvit_Helpdesk_Model_Field $object */
     if (!$object->getId()) {
         $object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
         $object->setCode($this->normalize($object->getCode()));
         if (in_array($object->getCode(), array('name', 'code', 'external_id', 'user_id', 'description', 'customer_email', 'customer_name', 'order_id', 'last_reply_at'))) {
             throw new Exception("Code {$object->getCode()} is not allowed. Please, try different code");
         }
     }
     $object->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
     return parent::_beforeSave($object);
 }
开发者ID:cesarfelip3,项目名称:clevermage_new,代码行数:13,代码来源:Mirasvit_Helpdesk_Model_Resource_Field.php

示例3: _beforeSave

 /**
  * Validate website code before object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Resource_Website
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $object->getCode())) {
         Mage::throwException(Mage::helper('core')->__('Website code may only contain letters (a-z), numbers (0-9) or underscore(_), the first character must be a letter'));
     }
     return parent::_beforeSave($object);
 }
开发者ID:monkviper,项目名称:magento-lite,代码行数:13,代码来源:Website.php

示例4: _beforeDelete

 /**
  * Check if group uses as default
  *
  * @param  Mage_Core_Model_Abstract $group
  * @throws Mage_Core_Exception
  * @return Mage_Core_Model_Resource_Db_Abstract
  */
 protected function _beforeDelete(Mage_Core_Model_Abstract $group)
 {
     if ($group->usesAsDefault()) {
         Mage::throwException(Mage::helper('Mage_Customer_Helper_Data')->__('The group "%s" cannot be deleted', $group->getCode()));
     }
     return parent::_beforeDelete($group);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:14,代码来源:Group.php

示例5: _beforeSave

 /**
  * Check store code before save
  *
  * @param Mage_Core_Model_Abstract $model
  * @return Mage_Core_Model_Resource_Store
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $model)
 {
     if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $model->getCode())) {
         Mage::throwException(Mage::helper('core')->__('The store code may contain only letters (a-z), numbers (0-9) or underscore(_), the first character must be a letter'));
     }
     return $this;
 }
开发者ID:SalesOneGit,项目名称:s1_magento,代码行数:13,代码来源:Store.php

示例6: _beforeSave

 /**
  * Apply processing before saving object
  *
  * @param Mage_Core_Model_Abstract $object
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getCode()) {
         throw new Exception(Mage::helper('ibanners')->__('Banner group must have a unique code'));
     }
     $object->setCode($this->formatGroupCode($object->getCode()));
     if (Mage::getDesign()->getArea() == 'adminhtml') {
         foreach ($object->getData() as $field => $value) {
             if (preg_match("/^use_config_([a-zA-Z_]{1,})\$/", $field, $result)) {
                 $object->setData($result[1], null);
                 $object->unsetData($field);
             }
         }
     }
     return parent::_beforeSave($object);
 }
开发者ID:navin1004,项目名称:treatmandu,代码行数:21,代码来源:Group.php

示例7: _afterSave

 /**
  * Processing object after save data
  * Update app_code as Store + Device + 123 (increment).
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Abstract
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $appCode = $object->getCode();
     $isCodePrefixed = $object->isCodePrefixed();
     if (!$isCodePrefixed) {
         $this->_getWriteAdapter()->update($this->getMainTable(), array('code' => $appCode . $object->getId()), $this->_getWriteAdapter()->quoteInto($this->getIdFieldName() . '=?', $object->getId()));
     }
     return parent::_afterSave($object);
 }
开发者ID:Airmal,项目名称:Magento-Em,代码行数:16,代码来源:Application.php


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