Re: habtm with different roles

2007-08-26 Thread [EMAIL PROTECTED]
Try something like this: var $belongsTo = array( 'Author' => array ( 'className' => 'User', 'foreignKey' => 'author_id' ), 'Recipient' => array ( 'className' => 'User', 'foreignKey' => 'recipient_id' )

Re: habtm with different roles

2007-08-26 Thread deepc
you are right, it's better this way. Thanks. But i still haven'f found out how to define the 2 assocs I tried with two belongsTo, but i only get the last one (in that case recipient). Is it posible to do them both? --~--~-~--~~~---~--~~ You received this message b

Re: habtm with different roles

2007-08-21 Thread RichardAtHome
What you have is: A message has an author and a recipient. Both the author and recipient are users so Message Table: id, Primary Key author_id, Foreign Key to Users table recipient_id, Foreign Key to Users table Check out the docs for $belongsTo, you can tell cake that the author_id field poin

Re: habtm with different roles

2007-08-21 Thread RichardAtHome
Meant to add, this is not a HABTM relationship unless you want to link the message to multiple recipients and/or multiple authors On Aug 21, 4:04 pm, deepc <[EMAIL PROTECTED]> wrote: > A question to habtm. > I have an object message and user > A message could be a sent or an received message and

habtm with different roles

2007-08-21 Thread deepc
A question to habtm. I have an object message and user A message could be a sent or an received message and belongs to an user. Is it possible to model such different roles between the same object in cake? --~--~-~--~~~---~--~~ You received this message because yo