I'm not sure. Possible version of your problem.

TT evaluates your expression in LIST contex (it does internally
$stash->get(...) which works in list context in ::Stash::XS i suppose).

Therefore when you call
rs.search(1).search(2).all,
rs.search is executed in list context and not a resultset returned!

To solve the problem, use subexpressions (between periods (".")) that do not
depend on context.

rs.search_rs(1).search_rs(2).all

In case of relationships:

Instead of

[% list = user.categories.search(COND) %]

Use
[% list = user.related_resultset('categories').search(COND) %]
or
[% list = user.related_resultset('categories').search_rs(COND).all %]



2007/5/8, Jonas B. Nielsen <[EMAIL PROTECTED]>:

Hello,

I am experiencing some problems with DBIx::Class and
Template::Toolkit and my workarounds lead to unnessesary and ugly
bodies of code.

I am using MIME::Lite::TT::HTML in conjunction with DBIx::Class.

I am parsing an order object to: MIME::Lite::TT::HTML and everything
works fine for some of the order attributes, but when I have a look
at the orderlines associated
with the order, I do not get all the necessary data.

    my %params = (
        customer => $member,
        order    => $order,
    );

order.id gets shown and I then do a FOREACH in the template to
iterate over the orderlines:

[% FOREACH orderline = order.orderlines %]

This gives me: orderline.label

But the moment I start digging into the object structure I do not get
any data:

Examples:

orderline.carticle.carticles2prices.first.price
orderline.vat.rate

My orderlines.t show perfect data for the same syntax in Perl land,
but in TT nothing.

I will gladly provide a working demonstration of my problem, but for
know I just need to hear if any of you have some pointers to
solutions to this problem, before spending too much time attempting
to isolate this.

jonasbn

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive:
http://www.mail-archive.com/[email protected]/

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to