Hi all,
While creating a private message system in a community script, I defined this relation, in the User model class:
'privateMessages'=>array(self::MANY_MANY, 'PrivateMessage', 'rel_privateMessagesReceivers(userId, privateMessagesId)',
'condition' => 'deleted = 0'
),
It works great, but I want to do a little more. In the “rel_privateMessagesReceivers” table, I have another column; ‘opened’, which specifies if the user has opened the message or not. When i loop through a users messages, i want that information to be available, but how do i collect or edit it, through the mentioned relation above?
And: what is the correct way of creating a new relation between objects? I’ve been looking for something like $user->relate(‘privateMessages’, $messageObject), but I couldn’t find any similar functions.
Thanks in advance!