I have two ideas but I can't be sure which is the best for you. One way to go is to force joins (or possibly sub-selects) and sort on the modified field from the replies table. You wouldn't want to or need to get all the records just the "most recent" one.
Another way to go is to try to make something like counterCache but instead of updating a count you update a datetime field whenever a new record is created on existing one edited. So when a new reply is saved, Reply updates Thread which then updates Forum. You would end up with updated time-stamps in all your models. /Martin On Aug 25, 8:14 am, Braindead <markus.he...@gmail.com> wrote: > I want to build a forum with CakePHP. The forum actually consists of > many forums. Each forum hasMany threads. A thread hasMany replies. > Forums, threads and replies are stored in separate tables. All > assossiations are setup correctly. > > How can I sort threads and replies by date, so that the newest thread > or the thread with the newest reply comes first. > > Thanks, > Markus --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---