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


PHP Mage_Core_Model_Abstract::hasData方法代码示例

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


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

示例1: _beforeSave

 /**
  * Perform actions before object save
  *
  * @param Varien_Object $object
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getId()) {
         $object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
     }
     if ($object->hasData('stores') && is_array($object->getStores())) {
         $stores = $object->getStores();
         $stores[] = 0;
         $object->setStores($stores);
     } elseif ($object->hasData('stores')) {
         $object->setStores(array($object->getStores(), 0));
     }
     return $this;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:19,代码来源:Review.php

示例2: getIsUniqueManufacturerToStores

 /**
  * Check for unique of identifier of manufacturer(s) to selected store(s).
  *
  * @param Mage_Core_Model_Abstract $object
  * @return bool
  */
 public function getIsUniqueManufacturerToStores(Mage_Core_Model_Abstract $object)
 {
     if (Mage::app()->isSingleStoreMode() || !$object->hasData('store_ids')) {
         $stores = array(Mage_Core_Model_App::ADMIN_STORE_ID);
     } else {
         $stores = (array) $object->getData('store_ids');
     }
     $selectId = $this->_getCommanManufacturer($object->getData('manufacturer'), $stores);
     $fetchedSelectId = $this->_getWriteAdapter()->fetchRow($selectId);
     if (!$object['manufacturer_id']) {
         if ($fetchedSelectId['manufacturer_id']) {
             return false;
         }
     } elseif ($object['manufacturer'] == $fetchedSelectId['manufacturer'] && $object['manufacturer_id'] != $fetchedSelectId['manufacturer_id']) {
         return false;
     }
     $select = $this->_getLoadByIdentifierSelect($object->getData('identifier'), $stores);
     if ($object->getId()) {
         $select->where('mps.manufacturer_id <> ?', $object->getId());
     }
     if ($this->_getWriteAdapter()->fetchRow($select)) {
         return false;
     }
     return true;
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:31,代码来源:Manufacturer.php

示例3: extractEavAttributeValue

 /**
  * @param string                   $attributeCode
  * @param Mage_Core_Model_Abstract $object
  *
  * @return null|string
  */
 public function extractEavAttributeValue($attributeCode = null, Mage_Core_Model_Abstract $object)
 {
     if (!empty($attributeCode) && $object->hasData($attributeCode)) {
         return $object->getData($attributeCode);
     }
     return null;
 }
开发者ID:marcoescudeiro,项目名称:clickpag-magento,代码行数:13,代码来源:Attributes.php

示例4: _afterSave

 /**
  * Perform actions after object save
  *
  * @param Mage_Core_Model_Abstract $rule
  *
  * @return Mage_Core_Model_Mysql4_Abstract
  */
 protected function _afterSave(Mage_Core_Model_Abstract $rule)
 {
     if ($rule->hasData('website_ids')) {
         $this->_saveWebsiteIds($rule);
     }
     if ($rule->hasData('store_messages')) {
         $this->_saveMessageData($rule);
     }
     return parent::_afterSave($rule);
 }
开发者ID:bevello,项目名称:bevello,代码行数:17,代码来源:Rule.php

示例5: _afterSave

 /**
  * Save the meta data associated with the user
  *
  * @param Mage_Core_Model_Abstract $object
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     if ($keys = $object->getLoadedMetaKeys()) {
         foreach ($keys as $key) {
             if ($object->hasData($key)) {
                 $this->saveMeta($object, $key);
             }
         }
     }
     return parent::_afterSave($object);
 }
开发者ID:jokusafet,项目名称:MagentoSource,代码行数:16,代码来源:User.php

示例6: _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 ($object->hasData('area')) {
         $object->setData('areas_content', serialize($object->getData('area')));
     }
     return parent::_beforeSave($object);
 }
开发者ID:ashfaqphplhr,项目名称:artificiallawnsforturf,代码行数:11,代码来源:Template.php

示例7: _afterSave

 /**
  * Perform actions after object save
  *
  * @param Mage_Core_Model_Abstract $object
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     $id = $object->getId();
     $this->_getWriteAdapter()->delete($this->getTable('enterprise_customersegment/event'), array('segment_id = ?' => $id));
     if ($object->getMatchedEvents() && is_array($object->getMatchedEvents())) {
         foreach ($object->getMatchedEvents() as $event) {
             $data = array('segment_id' => $id, 'event' => $event);
             $this->_getWriteAdapter()->insert($this->getTable('enterprise_customersegment/event'), $data);
         }
     }
     if ($object->hasData('website_ids')) {
         $this->_saveWebsiteIds($object);
     }
     return parent::_afterSave($object);
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:20,代码来源:Segment.php

示例8: _beforeSave

 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if ($object->isObjectNew() && !$object->hasCreatedAt()) {
         $object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
     }
     if (!$object->hasStatus()) {
         $object->setStatus(Mirasvit_Email_Model_Queue::STATUS_PENDING)->setStatusMessage('Assignment of default status');
     }
     if ($object->hasData('args')) {
         $object->setArgsSerialized(serialize($object->getData('args')));
     }
     $this->_processHistory($object);
     $object->setUniqKeyMd5(md5($object->getUniqKey()));
     $object->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
     return parent::_beforeSave($object);
 }
开发者ID:ashfaqphplhr,项目名称:artificiallawnsforturf,代码行数:16,代码来源:Queue.php

示例9: _beforeSave

 /**
  * Add data to the comment that has not been set
  *
  * @param Mage_Core_Model_Abstract $object
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getCommentContent()) {
         throw new Exception('No content was set for the comment');
     }
     $session = Mage::getSingleton('customer/session');
     $user = Mage::getModel('wordpress/user');
     if ($session->isLoggedIn()) {
         $customer = $session->getCustomer();
         if (!$object->getCommentAuthor()) {
             $object->setCommentAuthor($customer->getName());
         }
         if (!$object->getCommentAuthorEmail()) {
             $object->setCommentAuthorEmail($customer->getEmail());
         }
         if ($user->loadCurrentLoggedInUser()) {
             $object->setUserId($user->getId());
         }
     } elseif (Mage::helper('wordpress')->getWpOption('comment_registration')) {
         throw new Exception('You must be logged in to comment on this post');
     }
     // Comment MUST have NAME & EMAIL
     if (Mage::helper('wordpress')->getWpOption('require_name_email')) {
         if (!$object->getCommentAuthor() || !$object->getCommentAuthorEmail()) {
             throw new Exception('Comment author name and email must be set');
         }
     }
     /*
      * Set comment dates
      */
     if (!$object->hasCommentDate()) {
         $object->setCommentDate(now());
     }
     if (!$object->hasCommentDateGmt()) {
         $object->setCommentDateGmt(gmdate('Y-m-d H:i:s'));
     }
     /**
      * Set comment Author IP
      */
     if (!$object->hasData('comment_author_IP')) {
         $object->setData('comment_author_IP', $_SERVER['REMOTE_ADDR']);
     }
     /**
      * Set comment status
      */
     if (Mage::helper('wordpress')->getWpOption('comment_moderation')) {
         // Before a comment appears An administrator must always approve the comment
         $object->setCommentApproved(0);
     } else {
         if (Mage::helper('wordpress')->getWpOption('comment_whitelist')) {
             // Comment author must have a previously approved comment
             if ($user->getId()) {
                 $select = $this->_getReadAdapter()->select()->from(Mage::helper('wordpress')->getTableName('comments'), 'comment_ID')->where('user_id=?', $user->getId())->where('comment_approved=?', 1)->limit(1);
                 if (!$this->_getReadAdapter()->fetchOne($select)) {
                     // User has no comments
                     $object->setCommentApproved(0);
                 }
             } else {
                 // User isn't logged in so can't have a previous comment
                 $object->setCommentApproved(0);
             }
         }
     }
     /**
      * Check for max links
      */
     $maxLinks = (int) Mage::helper('wordpress')->getWpOption('comment_max_links');
     if ($maxLinks > 0) {
         $matchedLinks = preg_match_all('/<a [^>]*href/i', $object->getCommentContent(), $output);
         if ($matchedLinks >= $maxLinks) {
             // Comment has too many links and is probably spam
             $object->setCommentApproved(0);
         }
     }
     return parent::_beforeSave($object);
 }
开发者ID:jokusafet,项目名称:MagentoSource,代码行数:81,代码来源:Comment.php

示例10: _afterSave

 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     if ($object->hasData('chain')) {
         $this->_saveChain($object);
     }
 }
开发者ID:ashfaqphplhr,项目名称:artificiallawnsforturf,代码行数:6,代码来源:Trigger.php

示例11: _afterSave

 /**
  * Bind reminder rule to and website(s).
  * Save store templates data.
  *
  * @param Mage_Core_Model_Abstract $rule
  * @return Enterprise_Reminder_Model_Resource_Rule
  */
 protected function _afterSave(Mage_Core_Model_Abstract $rule)
 {
     if ($rule->hasWebsiteIds()) {
         $websiteIds = $rule->getWebsiteIds();
         if (!is_array($websiteIds)) {
             $websiteIds = explode(',', (string) $websiteIds);
         }
         $this->bindRuleToEntity($rule->getId(), $websiteIds, 'website');
     }
     if ($rule->hasData('store_templates')) {
         $this->_saveStoreData($rule);
     }
     parent::_afterSave($rule);
     return $this;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:22,代码来源:Rule.php

示例12: _decodeSecureFields

 protected function _decodeSecureFields(Mage_Core_Model_Abstract $object)
 {
     foreach ($this->_secureFields as $field) {
         if ($object->hasData($field)) {
             $value = $object->getData($field);
             $value = $this->_commonHelper()->getCore()->decrypt($value);
             $object->setData($field, $value);
         }
     }
     return $this;
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:11,代码来源:Abstract.php

示例13: _prepareDataForSave

 /**
  * Prepare data for save
  *
  * @param   Mage_Core_Model_Abstract $object
  * @return  array
  */
 protected function _prepareDataForSave(Mage_Core_Model_Abstract $object)
 {
     $data = array();
     $fields = $this->_getWriteAdapter()->describeTable($this->getMainTable());
     foreach (array_keys($fields) as $field) {
         if ($object->hasData($field)) {
             $fieldValue = $object->getData($field);
             if ($fieldValue instanceof Zend_Db_Expr) {
                 $data[$field] = $fieldValue;
             } else {
                 if (null !== $fieldValue) {
                     $data[$field] = $this->_prepareValueForSave($fieldValue, $fields[$field]['DATA_TYPE']);
                 } elseif (!empty($fields[$field]['NULLABLE'])) {
                     $data[$field] = null;
                 }
             }
         }
     }
     return $data;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:26,代码来源:Mysql4_Abstract.php

示例14: _beforeSave

 /**
  * Perform actions before object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Resource_Db_Abstract|Magpleasure_Common_Model_Resource_Abstract
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     # Update Datetime Proceed
     if ($this->getUseUpdateDatetimeFilter()) {
         $now = new Zend_Date();
         $now = $now->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
         if (!$object->getId()) {
             $object->setCreatedAt($now);
         }
         $object->setUpdatedAt($now);
     }
     # Serialize Serializable Fields
     foreach ($this->_serializable as $fieldName) {
         if ($object->hasData($fieldName)) {
             try {
                 $object->setData($fieldName, serialize($object->getData($fieldName)));
             } catch (Exception $e) {
                 $this->_commonHelper()->getException()->logException($e);
             }
         }
     }
     # Image Fields
     foreach ($this->_imageFields as $fieldName) {
         if ($object->hasData($fieldName . "_delete")) {
             $toDelete = $object->getData($fieldName . "_delete");
             if ($toDelete && is_array($toDelete) && count($toDelete)) {
                 foreach ($toDelete as $fileName) {
                     try {
                         $fileName = str_replace("/", DS, $fieldName);
                         $fullPath = Mage::getBaseDir('media') . $fieldName;
                         if (file_exists($fullPath)) {
                             unlink($fullPath);
                         }
                     } catch (Exception $e) {
                         $this->_commonHelper()->getException()->logException($e);
                     }
                 }
             }
         }
     }
     # Generate Unique HASH if need
     if ($this->getUseHashHelper() && !$object->getId()) {
         $object->setData($this->getUseHashHelper(), $this->_generateUniqueHash());
     }
     parent::_beforeSave($object);
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:53,代码来源:Abstract.php


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