E.g. There is a MANY_MANY relationship between A and B, so the models are as followings:
class A extends CActiveRecord
{
public function relations()
{
return array(
'relation_a_b' => array(self::MANY_MANY, 'B', A_B('a_id','b_id'),
};
}
}
class B extends CActiveRecord
{
public function relations()
{
return array(
'relation_b_a' => array(self::MANY_MANY, 'A', A_B('b_id','a_id'),
};
}
}
and the tables in DB are: A, B and A_B. Then here comes the problems: if I want to delete some records in table A, how can I remove the referred records from A_B, or is there any function or parameter can do this?