本文整理汇总了PHP中Mage_Core_Model_Resource_Db_Abstract::_afterSave方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Resource_Db_Abstract::_afterSave方法的具体用法?PHP Mage_Core_Model_Resource_Db_Abstract::_afterSave怎么用?PHP Mage_Core_Model_Resource_Db_Abstract::_afterSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Resource_Db_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Resource_Db_Abstract::_afterSave方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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);
}
示例2: _afterSave
/**
* Update Store Group data after save store
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Store
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
parent::_afterSave($object);
$this->_updateGroupDefaultStore($object->getGroupId(), $object->getId());
$this->_changeGroup($object);
return $this;
}
示例3: _afterSave
/**
* Update a "layout update link" if relevant data is provided
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Layout
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$data = $object->getData();
if (isset($data['store_id']) && isset($data['area']) && isset($data['package']) && isset($data['theme'])) {
$this->_getWriteAdapter()->insertOnDuplicate($this->getTable('core_layout_link'), array('store_id' => $data['store_id'], 'area' => $data['area'], 'package' => $data['package'], 'theme' => $data['theme'], 'layout_update_id' => $object->getId()));
}
return parent::_afterSave($object);
}
示例4: _afterSave
/**
* Assign shipping rule to store views and linking rules
*
* @param Mage_Core_Model_Abstract $object
*
* @return Mage_Core_Model_Resource_Db_Abstract
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$this->_addLinkStores($object);
if ($object->hasCustomMethodRules()) {
$rules = Mage::helper('adminhtml/js')->decodeGridSerializedInput($object->getCustomMethodRules());
$this->_addLinkRules($object, $rules);
}
return parent::_afterSave($object);
}
示例5: _afterSave
/**
* Processing object after save data
* Update app_code as Store + Device + 123 (increment).
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Abstract
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$appCode = $object->getCode();
$isCodePrefixed = $object->isCodePrefixed();
if (!$isCodePrefixed) {
$this->_getWriteAdapter()->update($this->getMainTable(), array('code' => $appCode . $object->getId()), $this->_getWriteAdapter()->quoteInto($this->getIdFieldName() . '=?', $object->getId()));
}
return parent::_afterSave($object);
}
示例6: _afterSave
/**
* Update a "layout update link" if relevant data is provided
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Layout
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$data = $object->getData();
if (isset($data['store_id']) && isset($data['area']) && isset($data['package']) && isset($data['theme'])) {
$this->_getWriteAdapter()->insertOnDuplicate($this->getTable('core_layout_link'), array('store_id' => $data['store_id'], 'area' => $data['area'], 'package' => $data['package'], 'theme' => $data['theme'], 'layout_update_id' => $object->getId()));
}
Mage::app()->cleanCache(array('layout', Mage_Core_Model_Layout_Merge::LAYOUT_GENERAL_CACHE_TAG));
return parent::_afterSave($object);
}
示例7: _afterSave
/**
* Perform actions after object save
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Website
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
if ($object->getIsDefault()) {
$this->_getWriteAdapter()->update($this->getMainTable(), array('is_default' => 0));
$where = array('website_id = ?' => $object->getId());
$this->_getWriteAdapter()->update($this->getMainTable(), array('is_default' => 1), $where);
}
return parent::_afterSave($object);
}
示例8: _afterSave
/**
* Perform actions after object save
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Db_Abstract
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
if ($object->getAttributes()) {
foreach ($object->getAttributes() as $attribute) {
$attribute->setAttributeGroupId($object->getId());
$attribute->save();
}
}
return parent::_afterSave($object);
}
示例9: _afterSave
/**
* Method to run after save
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Db_Abstract
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$condition = array('agreement_id = ?' => $object->getId());
$this->_getWriteAdapter()->delete($this->getTable('checkout/agreement_store'), $condition);
foreach ((array) $object->getData('stores') as $store) {
$storeArray = array();
$storeArray['agreement_id'] = $object->getId();
$storeArray['store_id'] = $store;
$this->_getWriteAdapter()->insert($this->getTable('checkout/agreement_store'), $storeArray);
}
return parent::_afterSave($object);
}
示例10: _afterSave
/**
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Db_Abstract
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$condition = $this->_getWriteAdapter()->quoteInto('slider_id = ?', $object->getId());
$this->_getWriteAdapter()->delete($this->getTable('slider/slider_store'), $condition);
foreach ((array) $object->getData('stores') as $store) {
$storeArray = array();
$storeArray['slider_id'] = $object->getId();
$storeArray['store_id'] = $store;
$this->_getWriteAdapter()->insert($this->getTable('slider/slider_store'), $storeArray);
}
return parent::_afterSave($object);
}
示例11: _beforeSave
/**
* Prepare system report data to be saved
*
* @param Mage_Core_Model_Abstract $object
*
* @return Enterprise_Support_Model_Resource_Sysreport
*/
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
$object->setClientHost($this->getTool()->getClientHost());
$object->setReportVersion($this->getTool()->getVersion());
$object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
$object->setMagentoVersion(Mage::getVersion());
$types = $object->getReportTypes();
$flags = $this->_dataHelper->getSysReportCommandsListByReportTypes($types);
$object->setReportFlags(implode(',', $flags));
$object->setReportTypes(implode(',', $types));
$object->setReportData(serialize($object->getReportData()));
parent::_afterSave($object);
return $this;
}
示例12: _afterSave
/**
* Perform actions after object save
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Variable
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
parent::_afterSave($object);
if ($object->getUseDefaultValue()) {
/*
* remove store value
*/
$this->_getWriteAdapter()->delete($this->getTable('core/variable_value'), array('variable_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()));
} else {
$data = array('variable_id' => $object->getId(), 'store_id' => $object->getStoreId(), 'plain_value' => $object->getPlainValue(), 'html_value' => $object->getHtmlValue());
$data = $this->_prepareDataForTable(new Varien_Object($data), $this->getTable('core/variable_value'));
$this->_getWriteAdapter()->insertOnDuplicate($this->getTable('core/variable_value'), $data, array('plain_value', 'html_value'));
}
return $this;
}
示例13: _afterSave
/**
* Save assigned processes
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Index_Model_Resource_Event
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$processIds = $object->getProcessIds();
if (is_array($processIds)) {
$processTable = $this->getTable('index/process_event');
if (empty($processIds)) {
$this->_getWriteAdapter()->delete($processTable);
} else {
foreach ($processIds as $processId => $processStatus) {
$data = array('process_id' => $processId, 'event_id' => $object->getId(), 'status' => $processStatus);
$this->_getWriteAdapter()->insertOnDuplicate($processTable, $data, array('status'));
}
}
}
return parent::_afterSave($object);
}
示例14: _afterSave
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
if ($object->hasStoreLabels()) {
$labels = $object->getStoreLabels();
$this->_getWriteAdapter()->delete($this->_labelsTable, array('status = ?' => $object->getStatus()));
$data = array();
foreach ($labels as $storeId => $label) {
if (empty($label)) {
continue;
}
$data[] = array('status' => $object->getStatus(), 'store_id' => $storeId, 'label' => $label);
}
if (!empty($data)) {
$this->_getWriteAdapter()->insertMultiple($this->_labelsTable, $data);
}
}
return parent::_afterSave($object);
}
示例15: _afterSave
/**
* After save process
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Bundle_Model_Resource_Option
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
parent::_afterSave($object);
$condition = array('option_id = ?' => $object->getId(), 'store_id = ? OR store_id = 0' => $object->getStoreId());
$write = $this->_getWriteAdapter();
$write->delete($this->getTable('bundle/option_value'), $condition);
$data = new Varien_Object();
$data->setOptionId($object->getId())->setStoreId($object->getStoreId())->setTitle($object->getTitle());
$write->insert($this->getTable('bundle/option_value'), $data->getData());
/**
* also saving default value if this store view scope
*/
if ($object->getStoreId()) {
$data->setStoreId(0);
$data->setTitle($object->getDefaultTitle());
$write->insert($this->getTable('bundle/option_value'), $data->getData());
}
return $this;
}