I tried doing as you suggested..it all works fine except when I do this: my $new_product = Product->new(product_id => 100);
above line dies with :
died: Can't locate object method "product_id" via package "t::Product" at
/usr/lib/perl5/site_perl/5.8.6/Rose/DB/Object.pm line 1464
some other flag needs to be set to inform Rose::DB classes to use
'get_product_id' instead of 'product_id' ?
The test case files are attached.
-----------------------------
A better option is to make your own Metadata subclass and then override the
make_column_methods() method and change the auto_method_types() of all the
columns before calling through to the base class implementation:
package My::DB::Metadata;
use base 'Rose::DB::Object::Metadata';
sub make_column_methods
{
my($self) = shift;
foreach my $column ($self->columns)
{
$column->auto_method_types(qw(get set));
}
$self->SUPER::make_column_methods(@_);
}
Then configure your common object base class to use your custom metadata
class:
package My::DB::Object;
use base 'Rose::DB::Object';
use My::DB::Metadata;
sub meta_class { 'My::DB::Metadata' }
...
and you should be all set.
get_set_methods.tar
Description: Binary data
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Rose-db-object mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rose-db-object
