I have two tables, AUTHORS and BOOK which have one-to-many relationship i.e. AUTHORS can have multiple BOOK. Data get inserted but when i call admin page, i receive the above error.
AUTHORS.php (Model)
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(
'book' => array(self::BELONGS_TO, 'Book', 'book_id'),);
}
public function search()
{
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id);
$criteria->compare('name',$this->name,true);
$criteria->together= true;
$criteria->params=array('author.book_id=:book.id');
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
Book.php (model)
public function relations()
{
return array(
'authors' => array(self::HAS_MANY, 'Authors', 'book_id'),
);
}