[Dbix-class] Re: Retrieving join table info from many_to_many
Paul Makepeace
paulm at paulm.com
Sun Feb 17 23:11:48 GMT 2008
On 2/17/08, Paul Makepeace <paulm at paulm.com> wrote:
> I have two tables of things, user and widget. I have a join table
> user_widget and have set up the DBIC bits so I can say @widgets =
> $user->widgets(). Now, for each of @widgets I actually want a piece of
> info in user_widgets, color (i.e. each user can customize the
> appearance of their widget).
>
> Is there any way to get that (ideally prefetched) color from the join
> table, given a $bar? Or do I have to get a list of the join table
(I meant $widget here; it was previously 'foo' and 'bar' and that
seemed too abstract :-))
> entries prefetching widget and then iterate over that?
>
> I'm aiming for, e.g.,
>
> my @widgets :Stashed = $user->widgets;
>
> [% FOREACH widget = widgets %]
> <td>[% widget.name %] has color [% widget.[magic here?].color %]</td>
> [% END %]
>
> Thanks,
> Paul
>
More information about the DBIx-Class
mailing list