[CDBI] M-M relationships and values in the mapping table

Arshavir Grigorian grigorian at gmail.com
Wed Dec 5 20:47:21 GMT 2007


On Dec 5, 2007 5:23 AM, Perrin Harkins <perrin at elem.com> wrote:
> On Dec 5, 2007 2:54 AM, Arshavir Grigorian <grigorian at gmail.com> wrote:
> > I am looking at the following code snippet on the
> > http://wiki.class-dbi.com/wiki/Complex_many_to_many page.
> >
> >  my $story = Story->retrieve($id);
> >  foreach my $image ( $story->images ) {
> >    printf "%d -> %s [%s]", $image->priority,
> >      $image->image->file_name, $image->image->caption;
> >  }
>
> In that example, the has_many method images() actually returns
> StoryImage objects, not Image objects.  That's why priority() is a
> valid call on them.
>
> - Perrin
>

Ah. Makes sense now. Thanks, Perrin.



More information about the ClassDBI mailing list