I appreciate the ideas, but using distinct or limit is not going to change the situation. What is happening is the "SELECT (...) FROM areas (...)" statement is being called multiple times (once for every shift) and many of those times it says "WHERE area.id = 1" because many shifts have area_id = 1.
The only solution I can think of is to somehow just do a separate find from areas, somehow limiting the results to the area_ids in the shifts. Maybe that's not worth it, and it's just fine to have a bit of redundant related data. It's not that big a deal. Thanks for your thoughts! Jason On Apr 12, 7:58 am, Jon Bennett <[email protected]> wrote: > > $this->Person->id = $id; > > $this->Person- > >>contain('Shift.Area','ResidentCategory','OffDay','FloatingShift.Area','Ho > >>use'); > > $this->set('person', $this->Person->find('first')); > > > One thing to note that adds a level of complexity is that there are > > sifts and there are floating shifts. A shift can come from the same > > area as a floating shift, so there's even more chance for duplicate > > area data. > > You could limit Shift.area to one if it's a hasMany, > > $this->Person->id = $id; > $this->Person->contain( > 'Shift.Area'=>array('limit'=>1), > 'ResidentCategory', > 'OffD' > ); > > If you want only unique values, you could use distinct in the fields > array for the Shift.Area. > > J > > -- > jon bennett -www.jben.net- blog.jben.net 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 To unsubscribe, reply using "remove me" as the subject.
