"the view in turn, asks the model for some data to display it"

This sounds to me like it's an (bad) explanation past the controller.

Anyway, the view never asks anything from the model. The view is the
final stage (a format, if you want). The most important thing in MVC
is the C. Without the controller it would be sorta procedural and so
the whole object model would be useless.

The example you gave is an optional one. 99% you wont need to use
requestAction if your controllers and model relations are well thought
out.

Basicly it goes like this: request -> load controller -> load models
-> call action (using models) -> assign data -> render view.

And requestAction does nothing else. So there is no direct
Model<->View connection, even so it looks like that. As you can see by
the URL (first param) it calls the "news" controller and the "view"
action - not any specific model

HTH

On Mon, Mar 3, 2008 at 4:31 PM, djiize <[EMAIL PROTECTED]> wrote:
>
>  If Views directly ask Models to have Data:
>  1- what is Controllers' purpose?
>  2- how do you do business Logic with your data?
>
>
>
>  On 3 mar, 12:32, Marcel <[EMAIL PROTECTED]> wrote:
>  > Hi!
>  >
>  > I've been doing some research about MVC implementations in different
>  > frameworks. Now in allmost every book I have on my desk it says
>  > something like 'the view in turn, asks the model for some data to
>  > display it'. In cake I have noticed (if I'm correct) the controller is
>  > asking data from the model and that data is then passed to the view.
>  >
>  > Example: $newsItem = $this->requestAction("/news/view",
>  > array("id"=>1));
>  >
>  > My question is why this kind of implementation? It seams to be a bit
>  > of double work because having that kind of intermediate 'layer'
>  > between model and view.
>  >
>  > Just curious ;-)
>  >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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