I have some related tables in my DB, after save data in first I want to use new primary key to inserting in second table.to do that I use aftersave method in my model. but if I update first table after save method doesnt calls. Also class cactiverecord doesnt have afterupdate method. What is the better way to explain same functionality after update as aftersave?
I don’t know the exact reason why there is no validation and no before/after-methods for update. But you can just use save. If you want to determine whether this is an INSERT or UPDATE in your before/after-methods you can use the isNewRecord property. If you want to prevent validation, use “save(false)”.
can be done either way, but if we r taking use input for the child table too then its better to first validate both then save. if parent is validated true and child has errors, u have to call update then or save child table separately.