本文整理汇总了PHP中ActiveRecord::afterSave方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::afterSave方法的具体用法?PHP ActiveRecord::afterSave怎么用?PHP ActiveRecord::afterSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveRecord
的用法示例。
在下文中一共展示了ActiveRecord::afterSave方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterSave
public function afterSave()
{
if ($this->isNewRecord) {
$this->createTheme('site');
}
return parent::afterSave();
}
示例2: afterSave
public function afterSave()
{
parent::afterSave();
$sql = "UPDATE p_nfy_subscription_categories " . "set category = 'role_{$this->role_name}.' " . "where category = 'role_{$this->oldName}.';";
Yii::app()->db->createCommand($sql)->execute();
return true;
}
示例3: afterSave
/**
* After save event
*/
public function afterSave()
{
// Update Topic
PersonalMessageTopic::model()->updateByPk($this->topic_id, array('last_reply_created_at' => $this->created_at, 'last_reply_author_id' => $this->user_id));
// Send notifications
PersonalMessageTopic::model()->sendNotifications($this->topic_id, $this->id);
return parent::afterSave();
}
示例4: afterSave
/**
* @return boolean
*/
public function afterSave()
{
$this->order->updateTotalPrice();
$this->order->updateDeliveryPrice();
if ($this->isNewRecord) {
$product = ShopProduct::model()->findByPk($this->product_id);
$product->decreaseQuantity();
}
return parent::afterSave();
}
示例5: afterSave
public function afterSave()
{
//Yii::app()->cache->delete(Yii::app()->currency->cacheKey);
if ($this->default) {
ShopCurrency::model()->updateAll(array('default' => 0), 'id != :id', array(':id' => $this->id));
}
if ($this->main) {
ShopCurrency::model()->updateAll(array('main' => 0), 'id != :id', array(':id' => $this->id));
}
parent::afterSave();
}
示例6: afterSave
public function afterSave()
{
// Leave only one default language
/* if ($this->default)
{
self::model()->updateAll(array(
'default'=>0,
), 'id != '.$this->id);
} */
return parent::afterSave();
}
示例7: afterSave
public function afterSave()
{
if ($this->getIsNewRecord()) {
$this->addMessageCopies();
if (empty($this->conversation_id)) {
$this->conversation_id = $this->id;
$this->setIsNewRecord(FALSE);
$this->save(FALSE);
}
}
return parent::afterSave();
}
示例8: afterSave
public function afterSave()
{
parent::afterSave();
if (count($this->data) == 0) {
foreach (Sector::model()->findAll() as $sector) {
$data = new Data();
$data->metric_id = $this->id;
$data->sector_id = $sector->id;
$data->save();
}
}
}
示例9: afterSave
protected function afterSave()
{
if ($this->protected_ip) {
$this->protected_ip = json_decode($this->protected_ip, TRUE);
}
parent::afterSave();
}
示例10: afterSave
protected function afterSave()
{
if(parent::afterSave()) {
return true;
} else {
return false;
}
}
示例11: afterSave
public function afterSave()
{
// Process related products
if ($this->_related !== null) {
$this->clearRelatedProducts();
foreach ($this->_related as $id) {
$related = new ShopRelatedProduct();
$related->product_id = $this->id;
$related->related_id = $id;
$related->save(false, false);
}
}
// Save configurable attributes
if ($this->_configurable_attribute_changed === true) {
// Clear
Yii::app()->db->createCommand()->delete('{{shop_product_configurable_attributes}}', 'product_id = :id', array(':id' => $this->id));
foreach ($this->_configurable_attributes as $attr_id) {
Yii::app()->db->createCommand()->insert('{{shop_product_configurable_attributes}}', 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('{{shop_product_configurations}} t')->where(array('in', 't.configurable_id', array($this->id)))->queryAll();
foreach ($query as $row) {
$model = ShopProduct::model()->findByPk($row['product_id']);
if ($model) {
$this->updatePrices($model);
}
}
}
// $this->date_update = date('Y-m-d H:i:s');
return parent::afterSave();
}
示例12: afterSave
protected function afterSave()
{
if ($this->isNewRecord) {
$model = new UserProfiles();
$model->balance = UserProfiles::DEFAULT_BALANCE;
$model->user_id = $this->getPrimaryKey();
$model->save(FALSE);
}
parent::afterSave();
}
示例13: afterSave
public function afterSave()
{
$this->clearRouteCache();
return parent::afterSave();
}
示例14: afterSave
public function afterSave()
{
if (parent::afterSave()) {
Yii::app()->cache->flush('languages');
}
}
示例15: afterSave
public function afterSave()
{
parent::afterSave();
return true;
}