[Dbix-class] accessing columns in multi-step prefetches
Radoslaw Zielinski
radek at eo.pl
Mon Jan 29 07:58:42 GMT 2007
Christopher Heschong <chris at wiw.org> [27-01-2007 03:53]:
> So I have this code:
>
> my $rs = $self->search_related('watching', {},
> {
> select => [
> { distinct => 'item.id' }
> ],
> prefetch => { person => { relations => 'item' } },
[...]
> $thing = $rs->first;
[...]
> $thing->person->title; # works
> $thing->item->title; # Can't locate object method "item"
If person->has_many(relations), that'll be:
($thing->person->relations)[0]->item->title
But I'm not sure if it works with select => [].
--
Radosław Zieliński <radoslaw.zielinski at eo.pl>
eo Networks
More information about the Dbix-class
mailing list