I think you're referring to conventions, and I agree it's best to keep things DRY and place methods to fetch results in the model or app model rather than writing directly in the controller in most instances.
Personally I would say this is more to do with the MVC pattern rather than CakePHP directly and people will have their own preferences on how to handle this. On 6 July 2014 12:09, Jeremy Burns : Class Outfit < [email protected]> wrote: > 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. > -- Kind Regards Stephen Speakman -- 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.
