It is using the model. It's calling the 'find' method of the Post model with 
the 'all' parameter. The Post model is then using the core Model functions to 
do the database extraction.

On 6 Jul 2014, at 11:59, Sam Clauw <[email protected]> wrote:

> I've a question about the MVC in CakePHP. Normally, the model should take 
> responsability for all the database queries.
> 
> However, in the cookbook documentation, it seems this isn't respected. See 
> the following link: 
> http://book.cakephp.org/2.0/en/getting-started.html#create-a-posts-controller
> 
> As you can see, the index action of PostsController contains 
> "$this->Post->find('all')". Shouldn't this and this code for example:
> 
>         $this->set('areas', $this->Attraction->Area->find('list', array(
>             'conditions' => array(
>                 'Area.deleted' => null
>             ),
>             'order' => array(
>                 'Area.sequence ASC',
>                 'Area.name ASC'
>             )
>         )));
> 
> not be in the Model part instead of in the controller part???
> 
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to