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


PHP Mage_Core_Model_Resource_Db_Abstract类代码示例

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


在下文中一共展示了Mage_Core_Model_Resource_Db_Abstract类的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: _afterLoad

 /**
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Core_Model_Resource_Db_Abstract
  */
 protected function _afterLoad(Mage_Core_Model_Abstract $object)
 {
     if ($object->getData('additional')) {
         $object->setData('additional', Mage::helper('core')->jsonDecode($object->getData('additional')));
     }
     return parent::_afterLoad($object);
 }
开发者ID:shakhawat4g,项目名称:Magento-Gallery-Extension,代码行数:11,代码来源:Item.php

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

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

示例5: load

 /**
  * Load an object
  *
  * @param Mage_Core_Model_Abstract $object
  * @param mixed $value
  * @param string $field field to load by (defaults to model id)
  * @return Mage_Core_Model_Resource_Db_Abstract
  */
 public function load(Mage_Core_Model_Abstract $object, $value, $field = null)
 {
     if (!intval($value) && is_string($value)) {
         $field = 'role_id';
     }
     return parent::load($object, $value, $field);
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:15,代码来源:Role.php

示例6: testGetTableName

 /**
  * @magentoConfigFixture global/resources/db/table_prefix prefix_
  */
 public function testGetTableName()
 {
     $tableNameOrig = 'core_website';
     $tableSuffix = 'suffix';
     $tableName = $this->_model->getTable(array($tableNameOrig, $tableSuffix));
     $this->assertEquals('prefix_core_website_suffix', $tableName);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:10,代码来源:AbstractTest.php

示例7: testGetConnectionInMemoryCaching

 /**
  * Test that the model detects a connection when it becomes active
  */
 public function testGetConnectionInMemoryCaching()
 {
     $connection = new Varien_Db_Adapter_Pdo_Mysql(array('dbname' => 'test_dbname', 'username' => 'test_username', 'password' => 'test_password'));
     $this->_resource->expects($this->atLeastOnce())->method('getConnection')->with('core_read')->will($this->onConsecutiveCalls(false, $connection, false));
     $this->assertFalse($this->_model->getReadConnection());
     $this->assertSame($connection, $this->_model->getReadConnection(), 'Inactive connection should not be cached');
     $this->assertSame($connection, $this->_model->getReadConnection(), 'Active connection should be cached');
 }
开发者ID:nemphys,项目名称:magento2,代码行数:11,代码来源:AbstractTest.php

示例8: load

 /**
  * Load an object using 'identifier' field
  *
  * @param   Mage_Core_Model_Abstract    $object
  * @param   mixed                       $value
  * @param   string                      $field
  * @return  Scandi_MenuManager_Model_Resource_Item
  */
 public function load(Mage_Core_Model_Abstract $object, $value, $field = null)
 {
     if (!is_numeric($value) && is_null($field)) {
         $field = 'identifier';
     }
     return parent::load($object, $value, $field);
 }
开发者ID:scandiwebcom,项目名称:MagentoMenuManager,代码行数:15,代码来源:Item.php

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

示例10: _afterSave

 /**
  * Perform actions after object save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Eav_Model_Resource_Entity_Attribute_Set
  */
 protected function _afterSave(Mage_Core_Model_Abstract $object)
 {
     if ($object->getGroups()) {
         /* @var $group Mage_Eav_Model_Entity_Attribute_Group */
         foreach ($object->getGroups() as $group) {
             $group->setAttributeSetId($object->getId());
             if ($group->itemExists() && !$group->getId()) {
                 continue;
             }
             $group->save();
         }
     }
     if ($object->getRemoveGroups()) {
         foreach ($object->getRemoveGroups() as $group) {
             /* @var $group Mage_Eav_Model_Entity_Attribute_Group */
             $group->delete();
         }
         Mage::getResourceModel('eav/entity_attribute_group')->updateDefaultGroup($object->getId());
     }
     if ($object->getRemoveAttributes()) {
         foreach ($object->getRemoveAttributes() as $attribute) {
             /* @var $attribute Mage_Eav_Model_Entity_Attribute */
             $attribute->deleteEntity();
         }
     }
     return parent::_afterSave($object);
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:33,代码来源:Set.php

示例11: _afterLoad

 protected function _afterLoad(Mage_Core_Model_Abstract $object)
 {
     if ($object->getId()) {
         $stores = $this->lookupStoreIds($object->getId());
         $object->setData('store_id', $stores);
     }
     return parent::_afterLoad($object);
 }
开发者ID:macosxvn,项目名称:techheroes,代码行数:8,代码来源:Store.php

示例12: _prepareDataForSave

 /**
  * Prepare data for save
  *
  * @param   Mage_Core_Model_Abstract $object
  * @return  array
  */
 protected function _prepareDataForSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getId()) {
         $object->setCreatedAt(now());
     }
     $data = parent::_prepareDataForSave($object);
     return $data;
 }
开发者ID:jsiefer,项目名称:emarketing,代码行数:14,代码来源:Error.php

示例13: _getLoadSelect

 /**
  * Retrieve select object for load object data.
  *
  * @param string                $field  The field.
  * @param mixed                 $value  The value.
  * @param Rootd_Link_Model_Node $object The link model.
  * 
  * @return Zend_Db_Select
  */
 protected function _getLoadSelect($field, $value, $object)
 {
     $select = parent::_getLoadSelect($field, $value, $object);
     if (!is_null($object->getStoreId())) {
         $select->where('store_id IN(?)', array(Mage_Core_Model_App::ADMIN_STORE_ID, $object->getStoreId()))->order('store_id ' . Varien_Db_Select::SQL_DESC)->limit(1);
     }
     return $select;
 }
开发者ID:beejhuff,项目名称:rootd-link,代码行数:17,代码来源:Node.php

示例14: _getLoadSelect

 /**
  * Retrieve select object for load object data
  *
  * @param string                   $field
  * @param mixed                    $value
  * @param Mage_Core_Model_Abstract $object
  *
  * @return Zend_Db_Select
  */
 protected function _getLoadSelect($field, $value, $object)
 {
     $select = parent::_getLoadSelect($field, $value, $object);
     if ($object->getStoreId()) {
         $select->join(array('cps' => $this->getTable('store')), $this->getMainTable() . '.slideshow_id = `cps`.slideshow_id')->where('`cps`.store_id in (0, ?) ', $object->getStoreId())->order('store_id DESC')->limit(1);
     }
     return $select;
 }
开发者ID:remiebeling,项目名称:MageProfis_Slideshow,代码行数:17,代码来源:Slideshow.php

示例15: _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,代码来源:Slide.php


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