On Sun, May 3, 2009 at 11:57 PM, takabanana <ttorim...@gmail.com> wrote: > > So - if I needed a controller to be able to modify multiple tables > that are related to each other - I would do the changes in Behaviors, > which would be used by each Model (of each affected table) - correct? > > i.e. If multiple tables need to be modified at once, use a Behavior > (called by multiple Models) - since a Model (by itself) is related > only to a single table. > > Is this a correct assumption/statement?
It *might* be :-) It really depends on what you're trying to do. The "multiple models" aspect of behaviors is simply that any model might implement the behavior. But, in that sense, they're not all acted upon at once. It's just that any one of those models might "act as" the behavior when that particular model is saved, queried, etc. If what you need to do is save data to more than one table at a time, it's possible that you can get away with relying solely upon Cake's associations and how you set up your forms. Saving HABTM, for example. If you have a controller which $uses several models, you'll probably just want to save to them individually: $this->Model1->save(...) $this->Model2->save(...) Having said that, there's no reason why you couldn't use a behavior to save across several models. But we might just be complicating things unnecessarily. Can you post more information? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---