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


PHP Mage_Core_Model_Resource_Db_Abstract::_beforeSave方法代码示例

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


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

示例1: _beforeSave

 /**
  * Perform actions before object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Resource_Db_Abstract
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (is_array($object->getChanges()) && sizeof($object->getChanges())) {
         $object->setChanges(Zend_Json::encode($object->getChanges()));
     }
     return parent::_beforeSave($object);
 }
开发者ID:OurLaborisJoy,项目名称:FireGento_FlexCms,代码行数:13,代码来源:Changes.php

示例2: _beforeSave

 /**
  * Before model save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Enterprise_CatalogEvent_Model_Resource_Event
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (strlen($object->getSortOrder()) === 0) {
         $object->setSortOrder(null);
     }
     return parent::_beforeSave($object);
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:13,代码来源:Event.php

示例3: _beforeSave

 /**
  * Add creation date to object
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Resource_Db_Abstract
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getAddedAt()) {
         $object->setAddedAt($this->formatDate(true));
     }
     return parent::_beforeSave($object);
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:13,代码来源:Item.php

示例4: _beforeSave

 /**
  * Processing object before save data
  * Update app_code as Store + Device
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Abstract
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getId()) {
         $object->setCode($object->getCodePrefix());
     }
     return parent::_beforeSave($object);
 }
开发者ID:Airmal,项目名称:Magento-Em,代码行数:14,代码来源:Application.php

示例5: _beforeSave

 /**
  * Perform actions before object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Resource_Db_Abstract
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getSortOrder()) {
         $object->setSortOrder($this->_getMaxSortOrder($object) + 1);
     }
     return parent::_beforeSave($object);
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:13,代码来源:Group.php

示例6: _beforeSave

 public function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getId()) {
         $object->setCreatedate(now());
     }
     return parent::_beforeSave($object);
 }
开发者ID:Genmato,项目名称:ComperRepo,代码行数:7,代码来源:Versions.php

示例7: _beforeSave

 /**
  * Perform actions before object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Resource_Db_Abstract
  * @throws Mage_Core_Exception
  */
 public function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if ($date = $object->getDateFrom()) {
         $object->setDateFrom($this->formatDate($date));
     } else {
         $object->setDateFrom(null);
     }
     if ($date = $object->getDateTo()) {
         $object->setDateTo($this->formatDate($date));
     } else {
         $object->setDateTo(null);
     }
     if (!is_null($object->getDateFrom()) && !is_null($object->getDateTo()) && Varien_Date::toTimestamp($object->getDateFrom()) > Varien_Date::toTimestamp($object->getDateTo())) {
         Mage::throwException(Mage::helper('core')->__('Start date cannot be greater than end date.'));
     }
     $check = $this->_checkIntersection($object->getStoreId(), $object->getDateFrom(), $object->getDateTo(), $object->getId());
     if ($check) {
         Mage::throwException(Mage::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range.'));
     }
     if ($object->getDateFrom() === null) {
         $object->setDateFrom(new Zend_Db_Expr('null'));
     }
     if ($object->getDateTo() === null) {
         $object->setDateTo(new Zend_Db_Expr('null'));
     }
     parent::_beforeSave($object);
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:34,代码来源:Design.php

示例8: _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

示例9: _beforeSave

 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     // Object validation - null values allowed
     if ($object instanceof Webguys_Easytemplate_Model_Template_Data_Abstract && !is_null($object->getValue()) && !$object->isValid()) {
         throw new Exception('Form data not valid');
     }
     return parent::_beforeSave($object);
 }
开发者ID:ffuenf,项目名称:EasyTemplate,代码行数:8,代码来源:Abstract.php

示例10: _beforeSave

 /**
  * Perform actions before object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Enterprise_Reward_Model_Resource_Reward_History
  */
 public function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     parent::_beforeSave($object);
     if (is_array($object->getData('additional_data'))) {
         $object->setData('additional_data', serialize($object->getData('additional_data')));
     }
     return $this;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:14,代码来源:History.php

示例11: _beforeSave

 public function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getId()) {
         $object->setCreatedate(now())->setStatus(1);
         $this->generateUniqueAuthKey($object);
     }
     return parent::_beforeSave($object);
 }
开发者ID:Genmato,项目名称:ComperRepo,代码行数:8,代码来源:Auth.php

示例12: _beforeSave

 /**
  * process multiple select fields
  *
  * @access protected
  * @param Mage_Core_Model_Abstract $object
  * @return Lionleap_Temples_Model_Resource_Temple
  * @author Ultimate Module Creator
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $months = $object->getMonths();
     if (is_array($months)) {
         $object->setMonths(implode(',', $months));
     }
     return parent::_beforeSave($object);
 }
开发者ID:sshegde123,项目名称:wmp8,代码行数:16,代码来源:Temple.php

示例13: _beforeSave

 /**
  * Before save
  * @param Mage_Core_Model_Abstract $object
  * @return AntoineK_Slider_Model_Resource_Slider
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getId()) {
         $object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
     }
     $object->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
     return parent::_beforeSave($object);
 }
开发者ID:christinecardoso,项目名称:AntoineK_Slider,代码行数:13,代码来源:Slider.php

示例14: _beforeSave

 /**
  * Setting up created_at and updarted_at
  *
  * @param Mage_Core_Model_Abstract $object
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getCreatedAt()) {
         $object->setCreatedAt($this->formatDate(time()));
     }
     $object->setUpdatedAt($this->formatDate(time()));
     parent::_beforeSave($object);
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:13,代码来源:Profile.php

示例15: _beforeSave

 /**
  * Sets up performed at time if needed
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Dataflow_Model_Resource_Profile_History
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getPerformedAt()) {
         $object->setPerformedAt($this->formatDate(time()));
     }
     parent::_beforeSave($object);
     return $this;
 }
开发者ID:okite11,项目名称:frames21,代码行数:14,代码来源:History.php


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