[CDBI] Ordering by a foreign column

Matt S Trout dbix-class at trout.me.uk
Mon Nov 21 21:14:58 GMT 2005


On Mon, Nov 21, 2005 at 03:00:16PM -0600, Ken Youens-Clark wrote:
> Hi,
> 
> I've been hacking the "Hops" Catalyst sample CRUD application for my  
> own evil purposes, and I've gotten lots of stuff working relatively  
> easy.  For a couple of days, however, I've been stuck on how to get  
> my "list" view of a table to be able to sort on any of the columns  
> shown, including those from a foreign table (e.g., the "stringified"  
> version of a foreign key).  My model classes are based on Class::DBI,  
> of course, so I'm writing here to ask for guidance.
> 
> I Googled and found a similar thread ("order by a foreign key") from  
> back in August of this year:
> 
> 	http://lists.digitalcraftsmen.net/pipermail/classdbi/2005-August/ 
> 000065.html
> 
> I've followed through all the suggestions and have tried various  
> plugins and extensions such as Class::DBI::Sweet, Class::DBI::Pager,  
> Class::DBI::Plugin::Pager and Class::DBI::Plugin::RetrieveAll.  Of them:
> 
> Class::DBI::Sweet - doesn't work as advertised;  I can't get any  
> sorting whatsoever to work, either on a column in the table or an  
> expanded column;  actually, this module produces invalid SQL when I  
> specify the "prefetch" (the arg of which should be an arrayref, not  
> noted in the docs), and it seems to check the "has_a" and  
> "might_have" meta_info incorrectly

Any chance you could elaborate on "doesn't work as advertised" given I'm
using that exact feature in production on a number of sites?

-- 
     Matt S Trout       Specialists in Perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +




More information about the ClassDBI mailing list