物種模型包含警予的CActiveRecord的findAll與錯誤500
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(
'samples' => array(self::HAS_MANY, 'Sample', 'species_id'),
);
}
我想獲得的所有樣本屬於一個物種
$species= Species::model()->with('samples')->findAll(array('condition'=>'tax_id = :no','params'=>array(':no'=>$taxno)));
print_r($species);
$samples=$species->samples; //error here
print_r($samples);
當我剛print_r($species)
,這表明裏面的樣本值。但它不能通過$samples
在$samples=$species->samples;
它顯示error 500
。
與此錯誤什麼信息? – aslawin
您可以發佈您的表格結構。 –