Hello John, when using an one-to-many-relation get_objects_count() is wrong:
my %rose = (object_class => 'Product', require_objects => [qw(prices)], ); my $count = Rose::DB::Object::Manager->get_objects_count(%rose); printf("COUNT: %d\n\n", $count); my $products = Rose::DB::Object::Manager->get_objects(%rose); foreach my $product (@$products) { printf("ID: %d\n", $product->id); printf("NAME: %s\n", $product->name); print "\n"; } Gives the output: COUNT: 3 ID: 1 NAME: product1 ID: 2 NAME: product2See the attached example.tgz, also a small patch against the synopsis for RDBO.
I have seen more errors with one-to-many (returning double rows), but I have no simple example yet.
Thanks, bye, Uwe
Index: Object.pm =================================================================== RCS file: /cvsroot/rose/rose/modules/Rose-DB-Object/lib/Rose/DB/Object.pm,v retrieving revision 1.19 diff -u -r1.19 Object.pm --- Object.pm 27 Sep 2005 19:49:05 -0000 1.19 +++ Object.pm 3 Oct 2005 13:45:01 -0000 @@ -1216,7 +1216,7 @@ { type => 'one to many', class => 'Price', - column_map => { id => 'id_product' }, + column_map => { id => 'product_id' }, }, );
example.tgz
Description: GNU Unix tar archive