Re: Ordering by associated dates

2011-01-28 Thread Toby G
Thanks for the detailed response, ShadowCross. That's exactly what I was after. Now I read it, it all makes perfect sense. T On Jan 24, 9:38 pm, ShadowCross wrote: > Assuming > > ModelA hasMany ModelB > ModelB includes a date column called 'date' > > you could try: > > $this->ModelA->bindModel

Re: Ordering by associated dates

2011-01-24 Thread ShadowCross
Assuming ModelA hasMany ModelB ModelB includes a date column called 'date' you could try: $this->ModelA->bindModel(array( 'hasOne' => array( 'MaxDateModelB' => array( 'className' => 'ModelB', 'foreign_key => 'model_a_id', 'conditions' => 'MaxDateMo

Re: Ordering by associated dates

2011-01-23 Thread cricket
On Sun, Jan 23, 2011 at 4:56 AM, Toby G wrote: > Morning all, > > I'm a little stumped this morning, on how to sort a model's records > based on the max value of it's associated (has many) dates.  Initially > I used a find & then a sort, however I now need to paginate the > results, so I need to b

Ordering by associated dates

2011-01-23 Thread Toby G
Morning all, I'm a little stumped this morning, on how to sort a model's records based on the max value of it's associated (has many) dates. Initially I used a find & then a sort, however I now need to paginate the results, so I need to be able to order the results as part of the paginated find.