/** * After Save, delete LikeCount (Cache) for target object */ protected function afterSave() { Yii::app()->cache->delete('likes_' . $this->object_model . "_" . $this->object_id); $activity = Activity::CreateForContent($this); $activity->type = "Like"; $activity->module = "like"; // Object Id for likes are not the Like Object itself $activity->object_model = $this->object_model; $activity->object_id = $this->object_id; $activity->save(); $activity->fire(); // Send Notifications NewLikeNotification::fire($this); return parent::afterSave(); }
/** * After Saving of comments, fire an activity * * @return type */ protected function afterSave() { // flush the cache $this->flushCache(); $activity = Activity::CreateForContent($this); $activity->type = "CommentCreated"; $activity->module = "comment"; $activity->save(); $activity->fire(); // Send Notifications NewCommentNotification::fire($this); AlsoCommentedNotification::fire($this); return parent::afterSave(); }
/** * After Save, delete FavoritesCount (Cache) for target object */ protected function afterSave() { Yii::app()->cache->delete('favorites_' . $this->object_model . "_" . $this->object_id); return parent::afterSave(); }
/** * After Saving of comments, fire an activity * * @return type */ protected function afterSave() { // flush the cache $this->flushCache(); $activity = Activity::CreateForContent($this); $activity->type = "CommentCreated"; $activity->module = "comment"; $activity->save(); $activity->fire(); // Handle mentioned users // Execute before NewCommentNotification to avoid double notification when mentioned. UserMentioning::parse($this, $this->message); if ($this->isNewRecord) { // Send Notifications NewCommentNotification::fire($this); } return parent::afterSave(); }