Retrieve Associated Count

2009-03-17 Thread Tony Thomas
I have a simple hasMany relationship set up with CakePHP and I want to retrieve a couple of fields from the parent table based on the count of the child. The scenario: I have boxes that hold 81 aliquots each. (Each box is 9X9.) I want to retrieve the id and description from the boxes table of

Re: Retrieve Associated Count

2009-03-17 Thread Xoubaman
The counterCache field is updated with each insert or delete (maybe more often), so if your boxes are changing allt he time, it will not be a problem. If it isn't the case, you can fetch all the boxes and their count and take only the count81 using a foreach loop. On Mar 17, 5:17 pm, Tony