On 11/28/05 11:54 AM, "John Siracusa" <[EMAIL PROTECTED]> wrote:

> On 11/28/05, Sean Davis <[EMAIL PROTECTED]> wrote:
>> I have a loader that loads a class
>> 
>> My::DB::GMain
>> 
>> associated with table g_main and seems to load My::DB::GMain::Manager.
>> However, when I make this call:
>> 
>> my @gmain = My::DB::GMain::Manager->get_gmains(query=>[gene_id=>672]);
>> 
>> I get:
>> 
>> Can't locate object method "get_gmains" via package "My::DB::GMain::Manager"
>> at rdbo.loader.test.pl line 35.
>> 
>> From my reading of the docs, that should be the method name, I thought.
>> However, it appears that I am wrong.  Any suggestions?
> 
> The default convention manager expects table names to be plural, and
> uses the table name as the default plural base_name for manager
> methods.  So my guess is that the method is really named get_gmain(),
> not get_gmains().
> 
> (I keep meaning to add docs to summarize the default conventions,
> rather than having them spread throughout the extensive convention
> manager POD.)
> 
> To get a better idea of what's going on when using the loader, try the
> technique shown in the loader section of the tutorial that will print
> all the classes the loader makes for you.
> 
>   @classes = $loader->make_classes(...);
> 
>   foreach my $class (@classes)
>   {
>     if($class->isa('Rose::DB::Object'))
>     {
>       print $class->meta->perl_class_definition, "\n";
>     }
>     else # Rose::DB::Object::Manager subclasses
>     {
>       print $class->perl_class_definition, "\n";
>     }
>   }
> 
> -John

John,

I think my confusion was this:

I expected the accessor to be named the lowercase, plural version of the
class name:

My::DB::GMain is the class name, so I expected gmains.  In practice, I
looked a the loader code and it is using the ACTUAL table name, so the class
is:

My::DB::GMain with manager class My::DB::GMain::Manager, and method
get_g_main.  That works as expected now that I know what to expect.

Sean



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to