I have to admit I'm a little disappointed this aspect isn't handled a little more gracefully, but I'll work around it with your helpful suggestions.
Thanks! - Dustin Weber http://www.dustinweber.com ianh wrote: > I'm going to quickly tell you what I found, there is so much in your > post though that I cannot get into it all. Here are some pointers > though that I hope will move you forward. > > 1) In Cake 1.1.x the method you have used is more or less how its > done, there is no magic save multi models as far as I know outside of > HABTM relationships. > > 2) When confronted with similar situations I have created methods in > the model specifically to save data to multiple related models, it > keeps the controller looking cleaner which is my personal preference; > > 3) If you can use InnoDB tables or equivalent and can do some model > checking between saves there is transactional support in Cake, I > haven't figured out how to use it though. You can then rollback if one > of your saves fails; > > 4) The issue you mentioned in "if the user failed to enter a widget > name, the validation occurs after a new id is generated." is easy: > simply use this structure (1.1.x below, 1.2.x is a little different): > > if($this->Widget->validates($this->data) && $this->WidgetModel- > >validates($this->data)) > { > // do the saves one after the other, perhaps with some kind of error > checking in between? > } > > In terms of getting data to the view, I long ago abandoned the Cake > native validation in favour of more complex validation from here: > http://cakebaker.42dh.com/2006/02/06/yet-another-data-validation-approach/ > that approach works well and you can get multiple validation errors > from multiple models to your view with the helper. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
