我有 PHP 课
class SurveyQuestion extends CActiveRecord
{
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'surveyOptions' => array(self::HAS_MANY, 'SurveyOptions', 'surveyQuestion_id'),
'survey' => array(self::BELONGS_TO, 'Survey', 'survey_id'),
);
}
}
在控制器中,我想获取带有选项的调查列表,所以我正在做..
$this->renderJson(array('success'=>true, 'message'=>'Records Retrieved Successfully',
'data'=>SurveyQuestion::model()->with('surveyOptions')->findAll()));
但是当这个控制器方法被调用时,我得到了这个错误..
include(SurveyOptions.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
根据http://www.yiiframework.com/doc/guide/1.1/en/database.arr,我应该能够在每次调查中得到选项的回复。
我认为, inclue(SurveyOptions.php) 应该是 SurveyOption.php (没有's'),但我看不出有什么问题?