AFAIK there is no problem using a fields key inside 'contain'. It's a good way of drawing back less data.
Jeremy Burns Class Outfit [email protected] http://www.classoutfit.com On 31 Jan 2011, at 17:33, Tilen Majerle wrote: > i think (i'm not sure), but in contain key you should not use 'fields', > 'conditions' and so on keys, because this you should do when you make a model > associations, so you should do just this > > {{{ > > $this->Category->Behaviors->attach('Containable'); > $tempCategories = $this->Category->find('all', array( > 'fields' => array('id','title','description','order'), > 'order' => array("Parent.title" => "asc","Category.order" => "asc"), > 'contain'=>array( > 'Parent' , > 'Product' => array( > 'Variation' > ) > ) > )); > > }}} > > but like i said....i'm NOT sure.... > > > -- > Lep pozdrav, Tilen Majerle > http://majerle.eu > > > > 2011/1/31 TimG <[email protected]> > Hey, > This code below works well but the query is really slow. It adds five > seconds more to the page request time. Am I doing something wrong or > is it just the way it is? Also, is there a way to do this with a > custom query and would it be any quicker? Thanks in advance! > > $this->Category->Behaviors->attach('Containable'); > $tempCategories = $this->Category->find('all', array( > 'fields' => array('id','title','description','order'), > 'order' => array("Parent.title" => "asc","Category.order" => "asc"), > 'contain'=>array( > 'Parent' => array('fields' => > array('id','title','description')), > 'Product' => array('fields' => > array('id','title','description'), > 'conditions' => array('active'=>1), > 'Variation' => array('fields' => > array('id','title','price')) > )))); > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group at > http://groups.google.com/group/cake-php > > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
