class Province 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.
/* ทดสอบ 1 to 1 */
return array(
'slogan'=>array(self::HAS_ONE, 'slogan', 'provinceID'),
'districts'=>array(self::HAS_MANY, 'district', 'provinceID'),
);
}
...........
...........
}
And
class District 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(
'provinces'=>array(self::BELONGS_TO, 'province', 'provinceID'),
);
}
.....
.....
}
i test in localhost is work. (Xampp WindowsXP)
what happend on server of me is error.
http://dev.bungkhan.com/province/district/index
is error or page use relations.
other is work (don’t use relations). http://dev.bungkhan.com/province
Thank you. ขอบคุณครับ