I'm also still learning this MVC concept.  I thought that a model
should only do things (functions/process data) that is from it's own
table?  (Or doI still not quite get it?)  I find that usually I put
processes that need data from different tables (models) into the
controllers, so my controllers are fat...  Is there an example
(tutorial?) with complex process that is done the right way?

Iqbal S.

On Apr 10, 3:20 pm, Jeremy Burns <[email protected]> wrote:
> Putting as many functions and processes into the model as possible. It's also 
> very useful because you can do <code> 
> $this->RelatedModel->DistantRelatedModel->function() </code> too - much 
> easier than trying to run a function from 'that' controller  in 'this' 
> controller.
>
> Jeremy Burns
> [email protected]
>
> On 10 Apr 2010, at 08:14, paws_galuten wrote:
>
> > Where does the "fat model" come into the picture?
>
> > On Apr 9, 9:43 pm, Jeremy Burns <[email protected]> wrote:
> >> This could well start a storm of "you're not quite right" replies - but I 
> >> think the spirit of this answer is about right.
>
> >> In MVC:
> >> Models do all the data humping and nothing else. Models can have 
> >> behaviours (such as the tree behaviour).
> >> Controllers control how the application flows. Controllers can have 
> >> components that perform specific functions shared by many/all controllers. 
> >> Controllers talk to models to retrieve/save data, and then send it to 
> >> views.
> >> Views do all the presentation and user interaction. Views shouldn't really 
> >> contain too much logic - but they can have helpers that handle recurring 
> >> specific display tasks (such as your time slot issue).
>
> >> So by the presentation layers, I mean the view part.
>
> >> Jeremy Burns
> >> [email protected]
>
> >> On 10 Apr 2010, at 05:33, paws_galuten wrote:
>
> >>> Ah, a helper... ok. I'll research that. Where do helpers fit into the
> >>> MVC pattern?
> >>> What do you mean by "presentation layer?"
>
> >>> On Apr 9, 8:17 pm, Jeremy Burns <[email protected]> wrote:
> >>>> Is this for the presentation layer? If so, the controller can call the 
> >>>> raw data from the model and then the display logic probably belongs in a 
> >>>> helper?
>
> >>>> Jeremy Burns
> >>>> [email protected]
>
> >>>> On 10 Apr 2010, at 02:00, paws_galuten wrote:
>
> >>>>> I am learning that data manipulation needs to be done in the model.
> >>>>> Fat Model, thin controller. Ok, so I'm trying to wrap my mind around
> >>>>> something. Here's my example:
>
> >>>>> Let's assume these tables:
>
> >>>>> people (id, name)
> >>>>> events (id, name, day, time)
> >>>>> events_people (event_id, person_id)
>
> >>>>> So, people HABTM events. totally cool so far.
>
> >>>>> Now, let's say that when viewing a person I want to see all of the
> >>>>> events organized into time slots based on another table in the
> >>>>> database:
>
> >>>>> times (id, day, start, end)
>
> >>>>> There's no relationship between events and times. It's just that I
> >>>>> want the event that happens on Friday at 2pm to be displayed in the
> >>>>> time slot that is Friday 1pm - 4pm, for example.
>
> >>>>> The point is, somewhere I have to cycle through the times and then
> >>>>> cycle through the events and see if the time of the event is between
> >>>>> "start" and "end" so I know if it should be displayed there. I guess I
> >>>>> need to do data logic like that in the model, but which model? Should
> >>>>> I have a method in the person model in which I also grab the data from
> >>>>> the time model and then return an array with all of the display data
> >>>>> neatly packaged for the view?
>
> >>>>> Maybe this is a confusing question. I think I'm just still trying to
> >>>>> understand the cakePHP conventions.
>
> >>>>> Any ideas would be greatly appreciated.
> >>>>> Thanks,
> >>>>> Jason
>
> >>>>> Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> >>>>> 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 [email protected]
> >>>>> To unsubscribe from this group, send email to
> >>>>> [email protected] 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 sitehttp://cakeqs.organdhelp 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 [email protected]
> >>> To unsubscribe from this group, send email to
> >>> [email protected] For more options, visit this group 
> >>> athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 [email protected]
> > To unsubscribe from this group, send email to
> > [email protected] For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to