Tuesday, April 6, 2010

Re: Split controller into many files

actually, the performance hit is minimal!
it was just a cleaner way of grouping the actions (see above)
now they have a clean structure - in the url they are called as well
as in which file they are
and you dont have to use extensive routing to achieve that

so if there is no reason other than performance you might as well
stick to this one controller


On 4 Apr., 13:33, Jonas <jonas.sand...@gmail.com> wrote:
> My controller is also around 300 kb. I've kind of inherited it, not my
> basic design and I don't have time (or permission) to make any changes
> like pushing functionality down to the models. The models is also
> based upon a 3rd party API so there is a bookingservice which is
> modelled in the booking.php model etc.
>
> Is there a performance hit having a large controller? Would I get a
> performance hit dividing the controller into components for each web
> page and/or splitting the controller into perhaps booking / user /
> invoice controllers?
>
> Thanks for any input!
>
> /Jonas
>
> On Apr 1, 3:29 pm, "Richard@Home" <richardath...@gmail.com> wrote:
>
> > 300kb sounds very large for even a complex controller.
>
> > Don't forget: Fat Model, Skinny Controller
>
> > Move all your controller queries into the model as methods, that
> > should slim down the controllers a bit
>
> > On Apr 1, 1:27 pm, euromark <dereurom...@googlemail.com> wrote:
>
> > > sure
> > > i did that with the user controller (used to be > 300kb)
>
> > > e.g. controllers:
> > > account (for changing account infos)
> > > members (pagination and profiles)
> > > overview (user statistics and stuff)
> > > with their own views!
>
> > > just use
> > > $uses = array('User');
> > > in all controllers to be able to use the same model+table
>
> > > On 1 Apr., 12:27, Jeremy Burns <jeremybu...@me.com> wrote:
>
> > > > You could move the functionality to a component?http://book.cakephp.org/view/993/Components
>
> > > > Jeremy Burns
> > > > jeremybu...@me.com
> > > > On 1 Apr 2010, at 11:25, Jonas wrote:
>
> > > > > Hello,
>
> > > > > Is there some recommended way of splitting a controller into several
> > > > > files? It's getting a bit too large for my taste but I cannot move the
> > > > > functionality out to the models. I would rather have the possibility
> > > > > of putting a separate page in a separate file. Is this possible with
> > > > > Cake?
>
> > > > > It's a booking site btw if it makes any difference.
>
> > > > > Regards,
> > > > > Jonas
>
> > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpotherswith their CakePHP related questions.
>
> > > > > 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 athttp://groups.google.com/group/cake-php?hl=en
>
> > > > > To unsubscribe, reply using "remove me" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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: