Skip Menu |

This queue is for tickets about the Rose-DB-Object CPAN distribution.

Report information
The Basics
Id: 30701
Status: resolved
Priority: 0/
Queue: Rose-DB-Object

People
Owner: Nobody in particular
Requestors: maxim [...] fnal.gov
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: strange naming of the foreign keys by Rose::DB::Object::Loader
Date: Tue, 13 Nov 2007 14:22:22 -0600
To: bug-Rose-DB-Object [...] rt.cpan.org
From: maxim <maxim [...] fnal.gov>
Hi John, I've noticed that Rose::DB::Object::Loader uses some interesting naming shcema for foreign keys while generating them for the same table name. For my three foreign keys ( one -to -many) pointing to the same name in other table its generated: foreign_keys => [ host => { class => 'perfSONAR_PS::Utils::PingER_DB::Host', key_columns => { ip_name_src => 'ip_name' }, }, host1 => { class => 'perfSONAR_PS::Utils::PingER_DB::Host', key_columns => { ip_name_hop => 'ip_name' }, }, host_obj => { class => 'perfSONAR_PS::Utils::PingER_DB::Host', key_columns => { ip_name_dst => 'ip_name' }, }, ], ---------------- Is it possible to name them in more consistent form: ( like <refname>_<table Show quoted text
name> )
becasue its hard to discover automaticaly what object will refer to what key. Thanks, Max Grigoriev. bug-Rose-DB-Object@rt.cpan.org
The ConventionManager controls this and other naming policies. The default naming scheme for foreign keys is described here: http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/ConventionManager.pm#auto_foreign_key_name (There's actually a related bug, already fixed in SVN, which causes the "*_object" naming scheme never to be tried.) To define your own naming policy, create your own ConventionManager subclass and override methods as desired. Then create your own Metadata subclass that uses your new ConventionManager: http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata.pm#convention_manager Finally, make your common Rose::DB::Object-derived base class use your new Metadata class as its meta_class http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object.pm#meta_class
Subject: RE: [rt.cpan.org #30701] strange naming of the foreign keys by Rose::DB::Object::Loader
Date: Tue, 13 Nov 2007 15:25:37 -0600
To: bug-Rose-DB-Object [...] rt.cpan.org
From: maxim <maxim [...] fnal.gov>
Thanks for reply, John, The question was how to make it in the use case when I am loading tables automatically. Your solution kind of eliminate the "automatically" phase. Sounds like its more clean way to define those classes by hand. --Maxim Show quoted text
> -----Original Message----- > From: John Siracusa via RT [mailto:bug-Rose-DB-Object@rt.cpan.org] > Sent: Tuesday, November 13, 2007 2:53 PM > To: maxim@fnal.gov > Subject: [rt.cpan.org #30701] strange naming of the foreign > keys by Rose::DB::Object::Loader > > > <URL: http://rt.cpan.org/Ticket/Display.html?id=30701 > > > The ConventionManager controls this and other naming > policies. The default naming scheme for foreign keys is > described here: > > http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/
ConventionManager.pm#auto_foreign_key_name Show quoted text
> > (There's actually a related bug, already fixed in SVN, which > causes the "*_object" naming scheme never to be tried.) > > To define your own naming policy, create your own > ConventionManager subclass and override methods as desired. > Then create your own Metadata subclass that uses your new > ConventionManager: > > http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/
Metadata.pm#convention_manager Show quoted text
> > Finally, make your common Rose::DB::Object-derived base class > use your new Metadata class as its meta_class > > http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object.
pm#meta_class Show quoted text
> >
On Tue Nov 13 16:26:10 2007, maxim@fnal.gov wrote: Show quoted text
> Thanks for reply, John, The question was how to make it in the use > case when I am loading tables automatically.
Just set base_class to your custom Rose::DB::Object-derived common base class set up as described earlier: http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Loader.pm#base_class Also, the mailing list is a better place for these questions :) https://lists.sourceforge.net/lists/listinfo/rose-db-object