Re: can you bypass model associations in a find
On Wed, Jan 5, 2011 at 9:44 AM, roundrightfarm wrote: > Thanks for your help. Got it to work... but > can you please explain why this didn't work > > $orders = $this->Order->find('all', > array('conditions'=>array('Order.week_id'=>$week_id)), > array('contain' => array('Box' => array('Item'))) > ); You have too many arrays there. $orders = $this->Order->find( 'all', array( 'conditions'=>array('Order.week_id'=>$week_id), 'contain' => array('Box' => array('Item')) ) ); 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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: can you bypass model associations in a find
Thanks for your help. Got it to work... but can you please explain why this didn't work $orders = $this->Order->find('all', array('conditions'=>array('Order.week_id'=>$week_id)), array('contain' => array('Box' => array('Item'))) ); and I had to do this instead $this->Order->contain(array('Box' => array('Item'))); $orders = $this->Order->find('all', array('conditions'=>array('Order.week_id'=>$week_id)) ); On Jan 5, 5:18 am, Jeremy Burns | Class Outfit wrote: > The Containable behaviour is your very best > friend:http://book.cakephp.org/view/1323/Containable > > Jeremy Burns > Class Outfit > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > On 5 Jan 2011, at 13:10, roundrightfarm wrote: > > > I'm having to do a find('all') with recursive = 2 to get at the data I > > need in my array. Unfortunately using this level of recursion also > > pulls in a bunch of unneeded data, creating a monster array which is > > stretching the memory limits. > > > Is there some syntax (perhaps involving 'fields') that will either > > allow me to select only the associations I need for this particular > > array, or to leave out the association I don't need. I'm asssuming > > it would not be considered best practices to start messing with my > > model files just to get a smaller array in this one situation. > > > Thanks > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 cake-php@googlegroups.com > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php?hl=en > > 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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: can you bypass model associations in a find
The Containable behaviour is your very best friend: http://book.cakephp.org/view/1323/Containable Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 5 Jan 2011, at 13:10, roundrightfarm wrote: > I'm having to do a find('all') with recursive = 2 to get at the data I > need in my array. Unfortunately using this level of recursion also > pulls in a bunch of unneeded data, creating a monster array which is > stretching the memory limits. > > Is there some syntax (perhaps involving 'fields') that will either > allow me to select only the associations I need for this particular > array, or to leave out the association I don't need. I'm asssuming > it would not be considered best practices to start messing with my > model files just to get a smaller array in this one situation. > > Thanks > > 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 cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en 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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
can you bypass model associations in a find
I'm having to do a find('all') with recursive = 2 to get at the data I need in my array. Unfortunately using this level of recursion also pulls in a bunch of unneeded data, creating a monster array which is stretching the memory limits. Is there some syntax (perhaps involving 'fields') that will either allow me to select only the associations I need for this particular array, or to leave out the association I don't need. I'm asssuming it would not be considered best practices to start messing with my model files just to get a smaller array in this one situation. Thanks 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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en