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

Arshavir Grigorian grigorian at gmail.com
Wed Dec 5 07:54:40 GMT 2007


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;

where "priority" is a column in the mapping table - StoryImages.

However, when I try to do the same, I get an error that "priority"
does not exist in the Image table, which it doesn't. I printed the
$story->images and got an aref of Image objects. I am wondering if I
need to declare anything extra to be able to access this field through
an Image object.


More information about the ClassDBI mailing list