On Wed, 2013-12-11 at 00:23 +0900, Hailin Hu wrote: > Well, can you try this way? > > Have join started from site_task, like this > $site_task->search( > ..., > join => ['site', 'task', 'issue'], > ) > > The relationships may be like this? > _SITE_TASK_->belongs_to('site' => 'Site'); > _SITE_TASK_->belongs_to('task' => 'Task'); > _SITE_TASK_->might_have('issue' => 'Issue', {'foreign.site_id' => > 'me.site_id', 'foreign.task_id' => 'me.task_id'}, {'join_type' => > 'LEFT'}); > > Reference: > http://search.cpan.org/~ribasushi/DBIx-Class-0.08250/lib/DBIx/Class/Relationship/Base.pm#add_relationship
Thanks. I did actually try something like that, but I ran into other problems (I forget exactly what, but when I was running the queries it wasn't generating quite the SQL I was expecting. I was going to post a question about that, but posted the other one instead). I'd be interested to know other people's opinions, but I'm beginning to think that a database design with 2 different tables providing a many-to-many relationship is a bad idea anyway, so I think I'll see if I can design it differently. Thanks, Andy _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk