Subject: | Using Model shortcut dispatches to wrong table |
Greetings.
Issue:
the statement:
$c->model('TktDB')->resultset('Commesse')->search(undef)
Generates the following (correct) SQL:
SELECT me.id, me.id_cliente, me.id_tipo_com, me.id_tipo_saldo,
me.id_stato_commessa, me.id_capo_commessa, me.descrizione, me.note,
me.monteore, me.scadenza FROM commesse me:
[...]
The following however:
$c->model('Orion::Tkt::Model::TktDB::Commesse')->search(undef);
Gives (wrongly) what follows:
SELECT me.id_commessa, me.id_fornitura FROM commesse4forniture me:
commesse4forniture is the table for a "has_many" of Commesse, whose
class is called Commesse_Forniture.
It looks like the dispatching of the convenience method becomes confused
by the two classes (tables?) having the same stem (commesse) and
proceeds to pick the wrong one.
Silly, but hard to find... I am running CentOS5, and I have the "bad
perl" warning... maybe that's an issue.
Environment details:
uname -a
Linux libra.orion.it 2.6.18-53.1.4.el5.centos.plus #1 SMP Fri Dec 7
07:04:56 EST 2007 i686 athlon i386 GNU/Linux
perl -v
This is perl, v5.8.8 built for i386-linux-thread-multi
Copyright 1987-2006, Larry Wall
perl-Catalyst-Runtime-5.7012-1.el5.rf
Catalyst warning
WARNING: DBIx::Class::StartupCheck: This version of Perl is likely to
exhibit
extremely slow performance for certain critical operations.
Please consider recompiling Perl. For more information, see
https://bugzilla.redhat.com/show_bug.cgi?id=196836 and/or
http://lists.scsys.co.uk/pipermail/dbix-class/2007-October/005119.html.
You can suppress this message by setting DBIC_NO_WARN_BAD_PERL=1 in your
environment.
Cheers,
alf