Re: Newbie-question: Store multiple model-objects with just one form
Cool! That's exactly what I've been searching for! :-) Thanks a lot! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Newbie-question: Store multiple model-objects with just one form
That's exactly what saveAll() is for... http://teknoid.wordpress.com/2008/08/01/practical-use-of-saveall-part-1-working-with-multiple-models/ There are a few other posts regarding this topic on my blog... Also, it is covered in the manual ;) On Dec 17, 4:38 pm, volka wrote: > Hi there, > I'd like to implement a form with which I want to achieve that the > parent model -objects and the child-models-objects (hasMany) are being > stored in the database by clicking on one submit button. > For example: > > Parent-Model 'book' (with attributes like 'author', 'title', etc) > hasMany 'chapter' (with atrributes like 'headline', 'order', > 'book_id') > hasMany 'image' (with attributes like 'name', 'path', 'chapter_id'). > > The action of the form sth. like 'app/book/add/. > > Does someone has a best practice for this? > Is it clean designed to call /app/chapter/add and app/image/add from > the book-controller function, or how would you do this? Does cakephp > forsee a different design in terms of cakephp conventions/paradigms? > > I'm sure it is just a newbie question...sorry :-/ > > Kind regards, > volka. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Newbie-question: Store multiple model-objects with just one form
Hi there, I'd like to implement a form with which I want to achieve that the parent model -objects and the child-models-objects (hasMany) are being stored in the database by clicking on one submit button. For example: Parent-Model 'book' (with attributes like 'author', 'title', etc) hasMany 'chapter' (with atrributes like 'headline', 'order', 'book_id') hasMany 'image' (with attributes like 'name', 'path', 'chapter_id'). The action of the form sth. like 'app/book/add/. Does someone has a best practice for this? Is it clean designed to call /app/chapter/add and app/image/add from the book-controller function, or how would you do this? Does cakephp forsee a different design in terms of cakephp conventions/paradigms? I'm sure it is just a newbie question...sorry :-/ Kind regards, volka. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---