[CDBI] Weirdness trying to limit Class::DBI has_many relationship from TT template

[prev] [thread] [next] [Date index for 2005/10/13]

From: Will Hawes
Subject: [CDBI] Weirdness trying to limit Class::DBI has_many relationship from TT template
Date: 09:40 on 13 Oct 2005
I'm attempting to limit the results returned via a has=5Fmany relationsh=
ip using Class::DBI 0.96 and Template Toolkit 2.14.

in My/Product.pm:
=5F=5FPACKAGE=5F=5F->has=5Fmany(images =3D> ['My::ProductImage' =3D> 'im=
age']);

in My/ProductImage.pm:
=5F=5FPACKAGE=5F=5F->has=5Fa('image' =3D> 'My::Image');

This code works fine - only My::Images with image=5Ftype =3D=3D 1 are re=
turned:

 my $product =3D My::Product->retrieve(1);
 my @images =3D $product->images(image=5Ftype =3D> 1)

Trying to do the same from a template doesn't work.

[% images =3D product.images(image=5Ftype =3D> 1); %]

I have tried several variations of the above in my template (e.g. replac=
ing "=3D>" with "=3D", trying with and without "{}"), but to no avail. I=
n every case, all My::Image objects get returned and the limit criteria =
are ignored. I don't understand why.


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] Weirdness trying to limit Class::DBI has_many relationship from TT template
Will Hawes 09:40 on 13 Oct 2005

Generated at 15:35 on 18 Oct 2005 by mariachi v0.52