Retaltioanl Active Record

Hi,

I am a lerner of yii framework ,any one can please show me how to insert and update of relational tables using relational active record.

Moved from Miscellaneous to General Discussion for Yii 1.1.x.


$parent = ParentModel::model()->find(...some conditions...);


$related = new RelatedModel;

$related->name = 'This is the related record';

$related->parent_id = $parent->id;

$related->save();