/** * @param $userId * @param $examination * @param $examinationEvent * @throws \CDbException * @throws \Exception */ protected function createComments($userId, $examination, $examinationEvent) { $comments = new Element_OphCiExamination_OptomComments(); $comments->event_id = $examinationEvent->id; $comments->created_user_id = $comments->last_modified_user_id = $userId; $comments->ready_for_second_eye = $examination['patient']['ready_for_second_eye']; $comments->comment = $examination['patient']['comments']; if (!$comments->save(true, null, true)) { throw new \CDbException('Complications failed: ' . print_r($comments->getErrors(), true)); } }