Tuesday, September 29, 2009

Re: Doubt in cake php

I don't see it as making the controller "fat", really. It's where
this call belongs. I usually think of fat controllers as doing some
of the models' heavy lifting for them.

But in this case, putting the code in your controller is clearly the
right thing to do, by Cake's MVC principles.

Don't worry too much about following some abstract, arbitrary
guidelines like "skinny controllers". It's just a general rule of
thumb; to me, it means to put as much data handling and managing as
possible in the models. Use the controllers to wrangle data around and
to handle requests (which includes access control, for most of my
work). The views should be limited to displaying stuff.

In certain situations you might want to put more logic in the views,
but this doesn't sound like one of them.

On Sep 28, 3:15 am, John Andersen <j.andersen...@gmail.com> wrote:
> It will not be much more fat, as the only thing each function used by
> a requestAction should be doing, is to call the model and return the
> models data.
> Enjoy,
>    John
>
> On Sep 28, 12:46 pm, hunny <saurabh85maha...@gmail.com> wrote:
>
> > On Sep 25, 10:27 am, John Andersen <j.andersen...@gmail.com> wrote:
>
> > > Look into the controllers method "requestAction", which allows you to
> > > retrieve the list of clubs in a view!
> > > Enjoy,
> > >    John
>
> > > On Sep 24, 11:59 am, hunny <saurabh85maha...@gmail.com> wrote:
> [snip]
> > Hi All,
>
> > Thanks for your help. I was just reluctant to put the code in the
> > controller because it makes your controller fat.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: