Thursday, August 27, 2009

Re: Where do you put code needed in controllers and models?

Most people seem to be fan of 'fat' models: put all your code that
handles data in your models and keep your controllers thin and easy to
read. Since your function parses data I would put it into the model
indeed. If you need it in every model/controller, you can add it to
app_model. You could also create a behaviour (the model's equivalent
of a component).

On 27 aug, 20:57, Nancy <nancy.milli...@gmail.com> wrote:
> Would a component be the right thing to use?  For instance, I have a
> routine that parses data and I need it both in models and
> controllers.  How do you include a component in model?
>
> I guess I can always access the model from the controller, so perhaps
> app_model is a better choice.
>
> Any opinions welcome!
--~--~---------~--~----~------------~-------~--~----~
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: