Tried searching for answers but can't find any good.

To keep it basic, I have a conversations model, which has a one to
many relationship with messages. In the conversations view i'd like to
list each conversation sorted by the date of the most recent message,
and display the body of that message. High level help would be fine,
and code examples a bonus.

What i've tried so far:

1) creating an hasOne relationship to the messages model. This just
results in the conversation getting duplicated for every related
message it has.

2) created an additional hasMany relationship to messages model with a
limit of 1 sorted by date desc. This sorta works, but the single
related message ends up in an array with one index of 0.

I know there has to be a more graceful solution for this. I'm an
experienced php programmer who's new to cake... so far really loving
it, but just getting bit in the a$$ with how to best leverage cake in
some instances.

Thanks in advance!

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

Reply via email to