Try:
var $hasOne = array(
'Sender' => array(
'className' => 'User',
'foreignKey' => 'sender',
'conditions' => 'User.id = Message.sender',
'fields' => '',
'order' => ''
),
'Recipient' => array(
'className' => 'User',
'foreignKey' => 'recipient',
'conditions' => 'User.id = Message.recipient',
'fields' => '',
'order' => ''
)
);
Jeremy Burns
[email protected]
On 4 Jun 2010, at 14:17, nils wrote:
> Hi all,
>
> I've got a "messages" model with two fields called "sender" and
> "recipient" which I'd like to link to the users table.
>
> I tried:
> ---------->
> var $hasOne = array(
> 'User' => array(
> 'className' => 'User',
> 'foreignKey' => 'sender',
> 'conditions' => 'User.id = Message.sender',
> 'fields' => '',
> 'order' => ''
> ),
> 'User' => array(
> 'className' => 'User',
> 'foreignKey' => 'recipient',
> 'conditions' => 'User.id = Message.recipient',
> 'fields' => '',
> 'order' => ''
> )
> );
> <----------
>
> ..which doesn't lead to anything, although it *looks* obvious! :)
>
> Any ideas?
>
> TIA,
>
> nils
>
> 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
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