brett gardner wrote:
> Is there anyway in DBIx::Class to set in the table class object the 
> fields you want the results to be sorted by by default. eg
> 
> __PACKAGE__->table('foo');
> __PACKAGE__->add_columns(qw/foo_id foo bar/);
> __PACKAGE__->sort_column('bar');
__PACKAGE__->resultset_attributes({ order_by => 'me.bar' });

is probably going to work for simple cases.

> 
> Or do you have to manually set the order_by field statement everywhere 
> you try and retrieve these items?
> 
> Also, is there an ability to have named groups of columns similar to 
> Class::DBI? eg
> 
> __PACKAGE__->add_column_group('menu'=>qw/foo bar/);
> 
> This would be useful for a default handler to display a menu of items. I 
> have actually implemented this myself but I don't think I did it in a 
> very smart or efficient way.

I'm not sure I see what needs implementing.

sub menu_columns { qw/foo bar/ };

...

$obj->menu_columns

:)

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

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

_______________________________________________
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