本文整理汇总了PHP中Mage_Core_Model_Mysql4_Abstract类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Mysql4_Abstract类的具体用法?PHP Mage_Core_Model_Mysql4_Abstract怎么用?PHP Mage_Core_Model_Mysql4_Abstract使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Core_Model_Mysql4_Abstract类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _afterLoad
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if (!$object->getIsMassDelete()) {
$this->_loadStore($object);
}
return parent::_afterLoad($object);
}
示例2: _afterDelete
/**
* After delete process
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Bundle_Model_Mysql4_Option
*/
protected function _afterDelete(Mage_Core_Model_Abstract $object)
{
parent::_afterDelete($object);
$condition = $this->_getWriteAdapter()->quoteInto('option_id = ?', $object->getId());
$this->_getWriteAdapter()->delete($this->getTable('option_value'), $condition);
return $this;
}
示例3: getTable
public function getTable($name)
{
$ret = parent::getTable($name);
$tablePrefix = (string) Mage::getConfig()->getTablePrefix();
$ret = preg_replace('~^' . preg_quote($tablePrefix) . '~', '', $ret);
return $ret;
}
示例4: load
public function load(Mage_Core_Model_Abstract $object, $value, $field = null)
{
if (is_numeric($value)) {
return parent::load($object, $value);
}
return parent::load($object, $value, 'query_text');
}
示例5: _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);
}
示例6: _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);
}
示例7: _afterSave
/**
* Assign page to store views
*
* @param Mage_Core_Model_Abstract $object
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
/*
$condition = $this->_getWriteAdapter()->quoteInto('group_id = ?', $object->getId());
// process faq item to store relation
$this->_getWriteAdapter()->delete($this->getTable('ves_brand/group_store'), $condition);
$stores = (array) $object->getData('stores');
if($stores){
foreach ((array) $object->getData('stores') as $store) {
$storeArray = array ();
$storeArray['group_id'] = $object->getId();
$storeArray['store_id'] = $store;
$this->_getWriteAdapter()->insert(
$this->getTable('ves_brand/group_store'), $storeArray);
}
}else{
$storeArray = array ();
$storeArray['group_id'] = $object->getId();
$storeArray['store_id'] = $object->getStoreId();
$this->_getWriteAdapter()->insert(
$this->getTable('ves_brand/group_store'), $storeArray);
}
*/
return parent::_afterSave($object);
}
示例8: _afterSave
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
if (!$object->getIsMassStatus()) {
$this->saveStore($object);
}
return parent::_afterSave($object);
}
示例9: _afterSave
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
parent::_afterSave($object);
// process object to store relation
$stores = $object->getData('store_id');
if (is_array($stores)) {
if (empty($stores) || in_array('0', $stores, true)) {
$stores = array('0');
}
} else {
$stores = array_map('intval', explode(',', strval($stores)));
}
$mode = $object->getData('mode');
$exclCh = $object->getData('exclude_children');
$priority = $object->getData(self::FIELD_PRIORITY);
$groups = $object->getData(self::FIELD_GROUPS);
if (is_array($groups)) {
$groups = implode(',', $groups);
} else {
$groups = (string) $groups;
}
foreach ($stores as $store) {
$this->_getWriteAdapter()->delete($this->_storeTable, $this->_getWriteAdapter()->quoteInto('hp_id = ?', $object->getId()) . ' AND ' . $this->_getWriteAdapter()->quoteInto('store_id = ?', $store));
if (!$object->getData('delete')) {
$this->_getWriteAdapter()->insert($this->_storeTable, array(self::FIELD_HP_ID => $object->getId(), self::FIELD_STORE_ID => $store, self::FIELD_HIDEPRICE_MODE => $mode, self::FIELD_IS_EXCL_CHILDREN => (int) (bool) $exclCh, self::FIELD_GROUPS => $groups, self::FIELD_PRIORITY => (int) $priority));
}
}
return $this;
}
示例10: _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);
}
示例11: _afterDelete
protected function _afterDelete(Mage_Core_Model_Abstract $object)
{
//delete values
$this->_getReadAdapter()->delete($this->getTable('webforms/results_values'), 'result_id = ' . $object->getId());
Mage::dispatchEvent('webforms_result_delete', array('result' => $object));
return parent::_afterDelete($object);
}
示例12: load
public function load(Mage_Core_Model_Abstract $object, $value, $field = null)
{
if (strcmp($value, (int) $value) !== 0) {
$field = 'post_id';
}
return parent::load($object, $value, $field);
}
示例13: _afterLoad
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getData('mapping_serialized')) {
$object->setMapping(unserialize($object->getData('mapping_serialized')));
}
return parent::_afterLoad($object);
}
示例14: load
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);
}
示例15: getValueTable
public function getValueTable($entityName, $valueType)
{
if (version_compare(Mage::getVersion(), '1.4.0.0', '>=')) {
return parent::getValueTable($entityName, $valueType);
}
return $this->getTable($entityName) . '_' . $valueType;
}