protected function afterDelete() { parent::afterDelete(); $this->postItem->delete(); Yii::log(CVarDumper::dumpAsString("Post Item Mirror deleted: " . $this->post_item_id)); PostItemSearch::model()->deleteAllByAttributes(array('post_item_id' => $this->post_item_id)); Yii::log('Thread Path: ' . getcwd()); if (!empty($this->attachment)) { unlink(Yii::app()->modulePath . '/community/files/' . $this->attachment . "_" . $this->post_item_id); } }
protected function afterSave() { parent::afterSave(); if ($this->isNewRecord) { $postMirror = new PostItemSearch(); $postMirror->post_item_id = $this->post_item_id; } else { $postMirror = PostItemSearch::model()->findByAttributes(array('post_item_id' => $this->post_item_id)); } $postMirror->title = $this->title; $postMirror->description = $this->description; $postMirror->save(); Yii::log("The following post was mirrored:"); Yii::log(CVarDumper::dumpAsString($postMirror)); }