attajob 2012-02-03 15:18:54 2879次浏览 0条回复 0 0 0
public function getProjectNumberList($pid){
$ProjectNumbers=Machine::model()->findAllByAttributes(array('machine_sn'=>$pid));
 foreach($ProjectNumbers as $ProjectNumber){
$listData[$ProjectNumber->project_number]=$ProjectNumber->projectRelation->project_number;
}
return CHtml::listData($ProjectNumbers, 'machine_sn', 'project_number');
}

在模型里面用了relation,然后这样写的时候就报错:Trying to get property of non-object

    没有找到数据。
您需要登录后才可以回复。登录 | 立即注册