I want to save product details, which will keep all older information and create new information revision when update product details. For that purpose, I created two table that called : product & product_detail like the following:
Product + id + vid // current version of Product Detail + status // of Product Product_detail + id + pid // product id , refer to Product.id + name + details
In this way, we have two model Class called Product, ProductDetail in Yii. By using Gii we have separate controller, form, and view.
My question is : "What’s the best way to make a form for user to create new product and detail information and save into two table in one request in Yii? "
When update, we load the information in two table, after that we need update vid in Product and create new record in Product_detail when User submit.
I’m new in Yii, Thank for your time !
Update: I found this tutorial http://www.yiiframework.com/wiki/19/how-to-use-a-single-form-to-collect-data-for-two-or-more-models/ , but is there any better way ? because my two table have the relation.