本文整理汇总了PHP中BaseModel::afterSave方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseModel::afterSave方法的具体用法?PHP BaseModel::afterSave怎么用?PHP BaseModel::afterSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseModel
的用法示例。
在下文中一共展示了BaseModel::afterSave方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterSave
public function afterSave()
{
// Leave only one default language
if ($this->default) {
self::model()->updateAll(array('default' => 0), 'id != ' . $this->id);
}
return parent::afterSave();
}
示例2: afterSave
/**
* @return boolean
*/
public function afterSave()
{
$this->order->updateTotalPrice();
$this->order->updateDeliveryPrice();
if ($this->isNewRecord) {
$product = StoreProduct::model()->findByPk($this->product_id);
$product->decreaseQuantity();
}
return parent::afterSave();
}
示例3: afterSave
public function afterSave()
{
Yii::app()->cache->delete(Yii::app()->currency->cacheKey);
if ($this->default) {
StoreCurrency::model()->updateAll(array('default' => 0), 'id != :id', array(':id' => $this->id));
}
if ($this->main) {
StoreCurrency::model()->updateAll(array('main' => 0), 'id != :id', array(':id' => $this->id));
}
parent::afterSave();
}
示例4: afterSave
protected function afterSave()
{
parent::afterSave();
return true;
}
示例5: afterSave
/**
* After save event
*/
public function afterSave()
{
// Clear payment relations
StoreDeliveryPayment::model()->deleteAllByAttributes(array('delivery_id' => $this->id));
foreach ($this->payment_methods as $pid) {
$model = new StoreDeliveryPayment();
$model->delivery_id = $this->id;
$model->payment_id = $pid;
$model->save(false);
}
return parent::afterSave();
}
示例6: afterSave
public function afterSave()
{
// Process related products
if ($this->_related !== null) {
$this->clearRelatedProducts();
foreach ($this->_related as $id) {
$related = new StoreRelatedProduct();
$related->product_id = $this->id;
$related->related_id = $id;
$related->save();
}
}
// Save configurable attributes
if ($this->_configurable_attribute_changed === true) {
// Clear
Yii::app()->db->createCommand()->delete('StoreProductConfigurableAttributes', 'product_id = :id', array(':id' => $this->id));
foreach ($this->_configurable_attributes as $attr_id) {
Yii::app()->db->createCommand()->insert('StoreProductConfigurableAttributes', array('product_id' => $this->id, 'attribute_id' => $attr_id));
}
}
// Process min and max price for configurable product
if ($this->use_configurations) {
$this->updatePrices($this);
} else {
// Check if product is configuration
$query = Yii::app()->db->createCommand()->from('StoreProductConfigurations t')->where(array('in', 't.configurable_id', array($this->id)))->queryAll();
foreach ($query as $row) {
$model = StoreProduct::model()->findByPk($row['product_id']);
if ($model) {
$this->updatePrices($model);
}
}
}
$this->updated = date('Y-m-d H:i:s');
return parent::afterSave();
}
示例7: afterSave
public function afterSave()
{
$this->clearRouteCache();
return parent::afterSave();
}
示例8: afterDelete
public function afterDelete()
{
Yii::app()->cache->delete('page_category_' . $this->url);
return parent::afterSave();
}
示例9: afterSave
/**
* After save event
*/
public function afterSave()
{
$this->clearRelations();
// Process manufacturers
if (!empty($this->_manufacturers)) {
foreach ($this->_manufacturers as $id) {
Yii::app()->db->createCommand()->insert('DiscountManufacturer', array('discount_id' => $this->id, 'manufacturer_id' => $id));
}
}
// Process categories
if (!empty($this->_categories)) {
foreach ($this->_categories as $id) {
Yii::app()->db->createCommand()->insert('DiscountCategory', array('discount_id' => $this->id, 'category_id' => $id));
}
}
return parent::afterSave();
}