Hi, does anyone have any guide on how to insert a new record via model instead of controller?
Thanks.
Hi, does anyone have any guide on how to insert a new record via model instead of controller?
Thanks.
Could you please explain a bit more please.
Well if you dont want to write a code for Insert record in controller then you can define a method in model and call that method in controller to perform this task.
Insert, Update and Delete actions In Model have sense only on events of Model AR.
So if you want to insert a new record of a model B, after of save Model A then you can use the event AfterSave() in model A.
check also
http://www.yiiframework.com/doc/api/1.1/CActiveRecordBehavior