[Dbix-class] Q: prefetch has_many relation
Bernhard Graf
dbic4 at augensalat.de
Thu Apr 8 19:37:12 GMT 2010
Am 08.04.2010 20:55, schrieb Bernhard Graf:
>
> for my $row ($rs->all) {
> say join(', ', $row->cds->get_column('title')->all);
> }
>
> it still fetched each of the CDs again one by one.
>
> Changing this to
>
> for my $row ($rs->all) {
> say join(',', map {$_->role_id} $row->user2roles->all);
> }
oops, I mean:
for my $row ($rs->all) {
say join(',', map {$_->title} $row->cds->all);
}
> fixed it indeed: no more additional queries. :)
More information about the DBIx-Class
mailing list