Oh, and this will work, almost.  You don't need the "->all".  The 
has_many('bars') relation creates a 'bars' method on each Foo Result object:

  foreach my $r_bar (map { $_->bars } $rs_foo->all) {
    $r_bar->some_method;
  }

For speed, prefetch bars.

> On 18 Apr 2017, at 16:59, Vladimir Melnik <v.mel...@uplink.ua> wrote:
> 
> ...or something like like that:
>       # MyApp::Schema::Result::Foo->has_many('bars', 
> 'MyApp::Schema::Result::Bar', { ... });
>       my $rs_foo = $schema->resultset('Foo')->search({ ... });
>       foreach my $r_bar (map { $_->bars->all } $rs_foo->all) {
>           $r_bar->some_method;
>       }



-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 

_______________________________________________
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