[Dbix-class] Problems with DBIx::Class and Template::Toolkit

Matt S Trout dbix-class at trout.me.uk
Tue May 8 14:47:28 GMT 2007


On Tue, May 08, 2007 at 12:42:03PM +0400, Oleg Pronin wrote:
> 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 [% user.categories_rs %] which DBIC started generating for a has_many rel
a while back as a workaround for this exact bit of TT brain damage

-- 
     Matt S Trout        Need help with your Catalyst or DBIx::Class project?
  Technical Director     Want a managed development or deployment platform?
Shadowcat Systems Ltd.   Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list