On Fri, May 18, 2018 at 09:52:09AM +0200, Stuart Dodds wrote:
> On 17/05/18 22:25, Matt S Trout 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 since I'm replying to the man who was kind enough to sponsor 
> > Shadowcat
> > to develop that module in the first place :)
> > 
> 
> Yes, I tried it yesterday and it is (almost) exactly what I need, thank you!
> 
> I say "almost" because my use case actually calls for a might_have 
> relationship (rather than has_many) but it is easy enough to ->first off the 
> entry in the rs.

Hmm. So, the only reason there's only a has_many there is because I didn't
really have any "good" use cases for belongs_to at the time.

I wouldn't be averse to adding the feature if you can write up a test for
it.

-- 
Matt S Trout - Shadowcat Systems - Perl consulting with a commit bit and a clue

http://shadowcat.co.uk/blog/matt-s-trout/   http://twitter.com/shadowcat_mst/

Email me now on mst (at) shadowcat.co.uk and let's chat about how our CPAN
commercial support, training and consultancy packages could help your team.

_______________________________________________
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

Reply via email to