public function countAnswer($answerId) { $criteria = new CDbCriteria(); $criteria->condition = "questionId=:questionId and find_in_set('" . $answerId . "',content)"; $criteria->params = array(':questionId' => $this->questionId); $count = QuestionResponse::model()->count($criteria); return $count; }
public function userResponse($userId) { $response = QuestionResponse::model()->findByAttributes(array('questionId' => $this->id, 'userId' => $userId)); return $response; }