try this:
public $belongsTo = array(
'Sender' => array(
'className' => 'User',
'fields' => array('id', 'full_name')
),
'Recipient' => array(
'className' => 'User',
'fields' => array('id', 'full_name')
)
);
You can read this on http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html
gloop
On Thursday, July 26, 2012 12:06:10 AM UTC+2, Teguh Mualim wrote:
Hi,--I'm trying to build a private messaging system.So I have a User Model and Conversation Model.Now within Conversation, I have 2 foreign keys referencing User mode. (i.e sender_id, recipient_id)What would be the best way to tackle the relationship in this situation?Thanks,Tee
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment