Multiple Reference To Same External Table

Hi everyone,

I’m quite new to Yii development and I find myself stuck at the very beginning…

In my project I have a table with two columns both pointing to an external table.

Something like:


table "item":

- user_id_1

- user_id_2


table "user":

- id

So an item i always associated with two users, but I do not want to differentiate them, and I want to be able to do something like


$item->users 

getting both the users.

And also the opposite:


$user->items

getting all items that reference the user id in user_id_1 or user_id_2.

Does this sound right? Any suggestion?