/** * This is invoked after the record is deleted. */ public function afterDelete() { parent::afterDelete(); Comment::deleteAll(['post_id' => $this->id, 'classify_type' => strtolower($this->getClassName())]); Tag::updateFrequency($this->tags, '', strtolower($this->getClassName())); }