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


PHP Mage_Core_Model_Mysql4_Abstract::_beforeSave方法代码示例

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


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

示例1: _beforeSave

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

示例2: _beforeSave

 /**
  * Perform actions before object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Mysql4_Website
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $object->getCode())) {
         AO::throwException(AO::helper('core')->__('Website code should contain only letters (a-z), numbers (0-9) or underscore(_), first character should be a letter'));
     }
     return parent::_beforeSave($object);
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:13,代码来源:Mysql4_Website.php

示例3: _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:votanlean,项目名称:Magento-Pruebas,代码行数:14,代码来源:Application.php

示例4: _beforeSave

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

示例5: _beforeSave

 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if ($object->isObjectNew() && !$object->hasCreatedAt()) {
         $object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
     }
     return parent::_beforeSave($object);
 }
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:7,代码来源:Mirasvit_Fpc_Model_Resource_Log.php

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

示例7: _beforeSave

 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $object->validate();
     $object->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
     if ($object->getAttributes() && is_array($object->getAttributes())) {
         $object->setAttributesSerialized(serialize($object->getAttributes()));
     }
     if ($object->getProperties() && is_array($object->getProperties())) {
         $object->setPropertiesSerialized(serialize($object->getProperties()));
     }
     if ($object->getData('attributes_serialized') != $object->getOrigData('attributes_serialized')) {
         $object->setStatus(2);
     }
     if ($object->getData('properties_serialized') != $object->getOrigData('properties_serialized')) {
         $object->setStatus(2);
     }
     if (!$object->getId() && !$object->getIndexInstance()->isAllowMultiInstance()) {
         //check if this index already exists
         $collection = Mage::getModel('searchindex/index')->getCollection()->addFieldToFilter('index_code', $object->getIndexCode());
         if ($collection->count() > 0) {
             Mage::throwException('The index for current content type already exists');
         }
     }
     return parent::_beforeSave($object);
 }
开发者ID:vishalpatel14,项目名称:indiankalaniketan,代码行数:25,代码来源:Index.php

示例8: _beforeSave

 public function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     if ($date = $object->getDateFrom()) {
         $date = Mage::app()->getLocale()->date($date, $format, null, false);
         $object->setDateFrom($date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
     } else {
         $object->setDateFrom(null);
     }
     if ($date = $object->getDateTo()) {
         $date = Mage::app()->getLocale()->date($date, $format, null, false);
         $object->setDateTo($date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
     } else {
         $object->setDateTo(null);
     }
     if (!is_null($object->getDateFrom()) && !is_null($object->getDateTo()) && strtotime($object->getDateFrom()) > strtotime($object->getDateTo())) {
         Mage::throwException(Mage::helper('core')->__('Start date can\'t 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 (is_null($object->getDateFrom())) {
         $object->setDateFrom(new Zend_Db_Expr('null'));
     }
     if (is_null($object->getDateTo())) {
         $object->setDateTo(new Zend_Db_Expr('null'));
     }
     parent::_beforeSave($object);
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:30,代码来源:Design.php

示例9: _beforeSave

 /**
  * Perform operations before object save
  *
  * @param Mage_Cms_Model_Block $object
  * @return Creativestyle_CheckoutByAmazon_Model_Mysql4_Log_Abstract
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getId()) {
         $object->setCreationTime(Mage::getSingleton('core/date')->gmtDate());
     }
     return parent::_beforeSave($object);
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:13,代码来源:Abstract.php

示例10: _beforeSave

 /**
  * Call-back function
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $url = $object->getUrl();
     $url = trim($url);
     $object->setUrl($url);
     return parent::_beforeSave($object);
 }
开发者ID:technomagegithub,项目名称:olgo.nl,代码行数:10,代码来源:Rewrite.php

示例11: _beforeSave

 /**
  * @param Mage_Core_Model_Abstract $object
  *
  * @return $this|Mage_Core_Model_Resource_Db_Abstract
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (is_array($object->getTypes())) {
         $object->setTypes(implode(',', $object->getTypes()));
     }
     return parent::_beforeSave($object);
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:12,代码来源:RejectPattern.php

示例12: _beforeSave

 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if ($object->isObjectNew() && !$object->hasCreatedAt()) {
         $object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
     }
     $object->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
     if (is_array($object->getAttr())) {
         $object->setAttr(serialize($object->getAttr()));
     }
     if (!$object->getChildrenCount()) {
         $object->setChildrenCount(0);
     }
     if ($object->getLevel() === null) {
         $object->setLevel(1);
     }
     if (!$object->getId()) {
         $object->setPosition($this->_getMaxPosition($object->getPath()) + 1);
         $path = explode('/', $object->getPath());
         $level = count($path);
         $object->setLevel($level + 1);
         if ($object->getParentId() == null) {
             $object->setLevel(1);
         }
         $object->setPath($object->getPath() . '/');
         $toUpdateChild = explode('/', $object->getPath());
         $this->_getWriteAdapter()->update($this->getTable('item'), array('children_count' => new Zend_Db_Expr('children_count + 1')), array('item_id IN(?)' => $toUpdateChild));
     }
     if ($object->getParentId() == 0) {
         $object->setParentId(null);
     }
     return parent::_beforeSave($object);
 }
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:32,代码来源:Glace_Menu_Model_Resource_Item.php

示例13: _beforeSave

 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $object->setStoreId($this->getStoreId());
     if (!$this->isUniqueCategory($object)) {
         Mage::throwException(Mage::helper('downloads')->__("Category '%s' already exist", $object->getTitle()));
     }
     return parent::_beforeSave($object);
 }
开发者ID:commercekitchen,项目名称:dualeyewear-magento,代码行数:8,代码来源:Categories.php

示例14: _beforeSave

 /**
  * Sets the created and modified date attributes.
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Litle_Palorus_Model_Mysql4_Vault
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getId()) {
         $object->setCreated(now());
     }
     $object->setUpdated(now());
     return parent::_beforeSave($object);
 }
开发者ID:nengineer,项目名称:litle-integration-magento,代码行数:14,代码来源:Vault.php

示例15: _beforeSave

 /**
  * Before save callback, set <created_at> and <updated_at> values
  *
  * @param Mage_Core_Model_Abstract $object
  * @return void
  */
 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:technomagegithub,项目名称:inmed-magento,代码行数:14,代码来源:Export.php


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