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

Perrin Harkins perrin at elem.com
Wed Dec 5 13:23:21 GMT 2007


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



More information about the ClassDBI mailing list