Hi,

I have a relation defined like this:

in Topics.pm:

__PACKAGE__->has_many( watchers => 'PH::S::Watching', { 'foreign.topic_id' => 'self.id' });

In a search() I need to do a left join between Topics and Watching, but I need to add another statement to the join condition.

If I use join => 'watchers',

the SQL generated is:

ph_topics me LEFT JOIN ph_watchers watchers ON ( watchers.topic_id = me.id )

but I need it to be like this:

ph_topics me LEFT JOIN ph_watchers watchers ON ( watchers.topic_id = me.id AND watchers.user_id = 5 )

(where 5 wlll be a parameter).

Before I jump to the 'from' attribute, can this be done with join? I could not figure it out...

Best regards,
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: [EMAIL PROTECTED]
Use XMPP!



_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/dbix-class@lists.rawmode.org/

Reply via email to