Multiple models with relation in one form

Hi guys,

I follow the tutorial about How to use a single form to collect data for two or more models? (http://www.yiiframew…oc/cookbook/19/) and it works great.

My problem is, that I have a 1-n relationship between my two tables.

Is there any standard/preferred way to save data in the first table and than save the 'id' as the foreingkey to the second one?

My idea would be to write my own save methond using transaction which is mentioned in the guide.

Please let me know what would be the best approach.

Thank you,

Daniel

Yeah, this should be fine. There’s no ‘standard’ way. ;)

i think it is best to set the relation in the controller action 'cause you can use the save model function also for saving the record with no relations or other model relations so if you overwrite it, it will have spefici code for one situation