protected function setPatient($patient_id) { if (!($this->patient = Patient::model()->findByPk($patient_id))) { throw new CHttpException(404, 'Invalid patient_id.'); } }