Webmaster's Community
Designing and Development => Programming => Topic started by: rahul on October 20, 2012, 08:34:34 AM
-
Hello,
I have one parent & child table and i have make relation ship using a foreign key. Primary key in parent table is forein key in child table.
now i want when i enter records in parents table the id of each records automatically goes in to child table.
any help will be appropriate
-
i want to achieve the same in yii framework
can some one help me out
Thanks in Advance....
-
hi perks
you can make use of AR hooks or you can make changes in your controller like this
public function afterSave() {
$model = new ChildModel();
$model->parendID = $this->id;
$model->save;
return parent::afterSave();
}
-
ahhh i see Thanks Phpdeveloper you are Rock.............