<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hi folks,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>I have a table which has two columns referencing the same class, something like this:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>"id, user1_id, user2_id"</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Both, user1_id and user2_id, contain User object ids.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Unfortunately I'm unable to set up two independent belongs_to relationships. I tried </DIV><DIV>this in my UserRelation class:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>__PACKAGE__-&gt;belongs_to( 'requestor', 'My::Schema::User', { 'foreign.id' =&gt; 'self.user1_id' }, { proxy =&gt; [ qw/id username/ ] } );</DIV><DIV>__PACKAGE__-&gt;belongs_to( 'receiver',  'My::Schema::User', { 'foreign.id' =&gt; 'self.user2_id' }, { proxy =&gt; [ qw/id username/ ] } );</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Depending on the order of these statements I get different results.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>My User class has the following has_many relations:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>__PACKAGE__-&gt;has_many( requested =&gt; 'My::Schema::UserRelation', { 'foreign.user1_id' =&gt; 'self.id' } );</DIV><DIV>__PACKAGE__-&gt;has_many( received  =&gt; 'My::Schema::UserRelation', { 'foreign.user2_id' =&gt; 'self.id' } );</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>$user-&gt;requested should return user2_id User objects, whereas $user-&gt;received should return user1_id User objects. But this</DIV><DIV>doesn't work as intended. I suppose that proxy is unable to determine the appropriate User object.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>It's probably just me messing things up, but maybe there's some switch which allows me to do what I want.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thanks!</DIV><DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>--Tobias</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>_______________________________________/\____ _ .  .</DIV><DIV>+ web ::::::: <A href="http://www.funkreich.de">http://www.funkreich.de</A></DIV><DIV>+ last.fm ::: <A href="http://www.last.fm/user/soulchild77">http://www.last.fm/user/soulchild77</A></DIV><DIV>----------------------------------------------- -- -  -</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN></SPAN> </DIV><BR></DIV></BODY></HTML>