On Mar 11, 11:51 pm, Alex Jeffery <alexanderjeff...@gmail.com> wrote:
> Hi,

Hi,

>
> (Fat Model)
> 1. The controller calls a custom function on the Users model. Eg
> registerUser($formData)
> 2. The User model validates and saves the new user.
> 3. The user model then calls the Portfolio model to create a new
> portfolio for the new user.
> 4. The Portfolio model calls the Currency model to get the default
> currency and creates the new portfolio for the new user.
>
> The advantage I can see to the Fat Model way is that the logic for
> registering a new user is all in one spot.
> So if I have many controllers that need to register a new user I can
> just use the same code.
>
> Is this on the right track?

Yes, this is the route to go.  You will get more code reuse out of
this plan, plus when you get around to writing unit tests, Model tests
are easier to write than controller tests.  So its win more.  For, if
it involves manipulating data it goes into a model, If it involves
pulling params from the request or application/user flow it goes into
the controller.

-Mark
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to