G'day, I have used a convention manager to deal with the fact that I don't use plurals.
create table Foo ( ID serial not null, Bar text not null, primary key ('ID') ); package My::ConventionManager; use base qw(Rose::DB::Object::ConventionManager); sub auto_table_name { ucfirst shift->class_to_table_singular } package My::Metadata; use base qw(Rose::DB::Object::Metadata::Auto::Pg); sub init_convention_manager { shift; My::ConventionManger->new(@_) } package My::Object; sub meta_class { 'My::Metadata' } sub init_db { My::DB->new } package My::Foo; __PACKAGE__->meta->auto_initialize; This works, it finds my Foo table just fine. However, I'm struggling to find the cleanest way to deal with the fact that the code I am working on has a strict convention of accessors/mutators being getFoo() and setFoo(). I know how to do this by calling ->meta->setup() manually, passing in the methods => {} hashref to set what you want the names to be. But if there is an aweful amount of columns, this is quite a tedious task. I have tried a few different things, all of which I can get to work. __PACKAGE__->auto_init_columns; for (__PACKAGE__->meta->columns) { __PACKAGE__->meta->column($_)->auto_method_types('get', 'set'); __PACKAGE__->meta->column($_)->method_name(get => "get$_"); __PACKAGE__->meta->column($_)->method_name(set => "set$_"); } __PACKAGE__->initialize; The above works. I can also edit the My::Metadata class to overload the auto_generate_column() method to effectively do the above for me. I'm wondering if either of the strategies I am using here are considered "the right way". Is there a way I can tell convention manager what the convention is for naming the accessors and mutators? If there isn't a way, and people think there should be, I'd be happy to work on a patch. regards, Danial ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object