Re: [Dbix-class] relationship with additional constraints?

2018-05-17 Thread Andrew Beverley
On Thu, 17 May 2018 20:25:07 + m...@shadowcat.co.uk wrote: > Surely http://p3rl.org/DBIx::Class::ParameterizedJoinHack is exactly > what's needed here - just use it on a belongs_to rel with a join_type of > left so non-matching entries are still returned, then prefetch that rel? > > (ironic

Re: [Dbix-class] relationship with additional constraints?

2018-05-17 Thread Matt S Trout
Surely http://p3rl.org/DBIx::Class::ParameterizedJoinHack is exactly what's needed here - just use it on a belongs_to rel with a join_type of left so non-matching entries are still returned, then prefetch that rel? (ironic since I'm replying to the man who was kind enough to sponsor Shadowcat to

Re: [Dbix-class] relationship with additional constraints?

2018-05-17 Thread Mitchell Elutovich
The following (below) I sent to "Frew" upon which he updated the post to indicate that the hack does not work. (Some of his hack does work and some not.) In his example is: my @rows = do { local $My::Schema::Result::Foo::SHARE_TYPE = [1, 2]; $rs->search(undef, { join => 'output_devices'

Re: [Dbix-class] relationship with additional constraints?

2018-05-17 Thread Andrew Beverley
On Thu, 17 May 2018 11:12:45 +0200 do...@united-domains.de wrote: > Is it possible to create a relationship which has, along with the > join condition, an additional constraint where the value could > somehow be passed when the search() method is called? This should answer your question:

[Dbix-class] relationship with additional constraints?

2018-05-17 Thread Stuart Dodds
Hello all, Is it possible to create a relationship which has, along with the join condition, an additional constraint where the value could somehow be passed when the search() method is called? What I would like to achieve (in sql) is this: (it's a contrived example, but the structure matches