FIRST: title is wrong when i started the post i was trying the cookbook of 2models in 1 form, now i realize that if im gonna ask i should ask bout my REAL requirement, not the work around i was trying to implement.
Hi , i’m new with Yii and im having some problems creating a simple web application. After a day trying to figure it out, i need help with the following issue
1-I have a HAS_MANY relationship where a Product has many pictures (and ,ofc each picture belongs to a product)
(relevant) TABLES
Product: id, code, description, category_id
Product_Image: id, product_id, image_name
What i need:
save product (OK) -> save the picture ->save the picture data in the product_image table.
I’m having some problems saving the picture data in the table, i know how to upload the picture but again, i can’t upload the picture in the products controller and i can’t call the product_images controller while im using the products_controller.
What should i do ?
LD;TR
The ideal solution is to have the add product form and then call the product_image creation form with the product_id already loaded in the model so i can save it. Any ideas about how to do this ?
I appreciate any help you can give me, a link to a similar case in the forums or anything that can help me with this problem.
PS: Im really , really bad writing (or talking, to be honest) about programming issues or solutions… so please let me know if i have to clarify something or give you more information. THANKS