Skip Menu |

This queue is for tickets about the DBIx-Class-Schema-Loader CPAN distribution.

Report information
The Basics
Id: 37279
Status: rejected
Priority: 0/
Queue: DBIx-Class-Schema-Loader

People
Owner: Nobody in particular
Requestors: samborsky_d [...] yahoo.com
Cc:
AdminCc:

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



Subject: object reference is broken when target table name ends with 'es'
Hi All, I've noticed that if SQL table has a name which looks like a plural form (e.g. 'obj_res'), then the object reference to this object becomes broken. There is a tiny script in the attached archive that shows the problem. It can be fixed by setting inflection rule (e.g. inflect_singular => {'obj_res' => 'obj_res'}). But IMHO it's not a proper solution of the problem. Thanks in advance, Dmitriy Samborskiy P.S. My environment is: $ perl -v This is perl, v5.8.8 built for i386-linux-thread-multi . . . $ rpm -q perl perl-5.8.8-10 $ uname -a Linux ac29.niisi.msk.ru 2.6.20-1.2962.fc6 #1 SMP Tue Jun 19 18:24:12 EDT 2007 i686 i686 i386 GNU/Linux
Subject: dbix-inflect-err.tar.gz
Download dbix-inflect-err.tar.gz
application/x-gzip 945b

Message body not shown because it is not plain text.

On Tue Jul 01 05:44:58 2008, samborsky_d@yahoo.com wrote: Show quoted text
> Hi All, > > I've noticed that if SQL table has a name > which looks like a plural form (e.g. 'obj_res'), > then the object reference to this object becomes broken.
It is not broken, it's just that the relationship name is singularised for belongs_to relationships (as documented). If you pass "debug => 1" in loader_options you'll see that the relationship is generated like this (the exact options may vary, this is from DBIx::Class::Schema::Loader 0.04999_05): Tst::Schema::Obj->belongs_to( "obj_re", "Tst::Schema::ObjRes", { id => "obj_res" }, { join_type => "LEFT OUTER" }, ); which means you need to use $obj->obj_re as the accessor. The correct way to override the singularisation whe Lingua::EN::Inflect::Number::to_S() gets it wrong is, as you've discovered, inflect_singular.
From: samborsky_d [...] yahoo.com
Show quoted text
> It is not broken, it's just that the relationship name > is singularised > for belongs_to relationships (as documented).
I assumed this problem as a bug, since the program's behaviour is affected on the name of SQL table. My test explicitly shows that. Show quoted text
> If you pass > "debug => 1" > in loader_options you'll see that the relationship is > generated like > this (the exact options may vary, this is from > DBIx::Class::Schema::Loader 0.04999_05): > > Tst::Schema::Obj->belongs_to( > "obj_re", > "Tst::Schema::ObjRes", > { id => "obj_res" }, > { join_type => "LEFT OUTER" }, > ); > > which means you need to use $obj->obj_re as the > accessor.
But I don't want to. I would like to use $obj->obj_res, i.e. using the same SQL table name (as it were for 'obj_aaa' SQL table name). So, why program's API rules are depending on exact table's name? Regards, Dmitry
Closing, works as designed.