Also with the find() make sure you have recursive set to -1 or 0 to cut back on the excess data collection.
On Jun 18, 9:53 am, Shaz <[email protected]> wrote: > $this->User->Photo->find() perhaps? > > From my understanding we should use the model associations (which > provide an efficient sql query if i remember correctly) first to see > if it gives us what we want, otherwise use findall/contain. > > On Jun 18, 7:21 am, "Alan Asher" <[email protected]> wrote: > > > I have a users model and a photos model, > > > Class users{ > > > Var belongsto=array( > > > 'Photos' > > > } > > > You get the idea, > > > When I run a $this->Some > > Model>find('all',array('contain'=>array('User','User.Photo'))) > > > It breaks this up into 2 sql statements so even with a limited amount of 20 > > results, there's a lot of redundancy and it costs time and processing. I'm > > about to rewrite all my inefficient finds into queries that have my own > > custom joins. > > > Does anyone have suggestions how to get the photos table to show up in the > > results without cake making a separate query? > > > Alan 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
