This is probably well documented somewhere but I wasn't aware of it after using Rose::DB for over a year so others may find this useful.

Rose::DB::Object class name clash:

The relationship in the following seems to create a class __PACKAGE__.'::Distribution' which clashes with my class of the same name.

   package CMUCS::UAM::Application ;

   __PACKAGE__->meta->setup
     ( ...
     , relationships =>
      [ Distribution =>
         { type            => 'one to one'
         , class           => __PACKAGE__.'::Distribution'
         , column_map      => { Id => 'App_Id' }
         }
     ) ;


Results in:

   Can't call method "Id" on unblessed reference at
   
/usr3/phdye/project/uam/cpan/lib/perl5/site_perl/5.6.1/Rose/DB/Object/MakeMethods/Generic.pm
   line 2288.

   # 7 : /@fac_p1 : Application : near
   
/usr3/phdye/project/uam/cpan/lib/perl5/site_perl/5.6.1/Rose/DB/Object/MakeMethods/Generic.pm
   2288
2278 2279 return $self->{$key} if(defined $self->{$key}); 2280 2281 my %key; 2282 2283 while(my($local_column, $foreign_column) =
   each(%$fk_columns))
     2284        {
     2285          my $local_method   =
   $meta->column_accessor_method_name($local_column);
     2286          my $foreign_method =
   $fk_meta->column_mutator_method_name($foreign_column);
2287 >>>>>>> $key{$foreign_method} = $self->$local_method(); 2289 2290 # XXX: Comment this out to allow null keys
     2291          unless(defined $key{$foreign_method})
     2292          {
     2293            keys(%$fk_columns); # reset iterator
     2294            $self->error("Could not load $name object - the " .
     2295                         "$local_method attribute is undefined");
     2296            return undef;
     2297          }
     2298        }

Changing the name of the relationship resolves to problem.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to