<?php /* @var $this NoticeController */ /* @var $data Notice */ $comment = AnswerComment::model()->with('user', 'answer.question')->findByPk($data['commentId']); $question = $comment->answer->question; if (!$comment || !$question) { return false; } ?> <?php echo CHtml::link($comment->user->name, $comment->user->pageUrl); echo Yii::t('app', '评论了你在'); ?> <?php echo CHtml::link($question->title, array('question/view', 'id' => $question->id)); echo Yii::t('app', '中的回答');
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return AnswerComment the loaded model * @throws CHttpException */ public function loadModel($id) { $model = AnswerComment::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }