AW: [Dbix-class] Base class behavior change from latest release to trunk

Hartmaier Alexander Alexander.Hartmaier at t-systems.at
Fri Nov 21 08:31:45 GMT 2008


Maybe there is a method named 'result_source' which conflicts with your col=
umn named result_source?
If you can't change the colname in the db try to use a different accessor.

-Alex
________________________________
Von: J. Shirley [jshirley at gmail.com]
Gesendet: Dienstag, 18. November 2008 03:49
An: DBIx::Class user and developer list
Betreff: [Dbix-class] Base class behavior change from latest release to tru=
nk

I have a schema that I was working on quite some time ago (about 3
months) and has picked up again.  The basics of it are multiple views
of the same table.  I have a common base class, and inherit from that
and then have a method that populates different keys based on the
result source.  To illustrate, imagine this:

package MyApp::Schema::BaseClass;

use Moose;
use parent 'DBIx::Class';

__PACKAGE__->table('foo');
__PACKAGE__->add_columns( result_source =3D> { data_type =3D> 'varchar',
size =3D> 255 } );

before 'insert' =3D> sub {
    my ( $self, $attrs ) =3D @_;
    $self->rel_source( $self->result_source->source_name );
};


1;

package MyApp::Schema::Foo;

use parent 'MyApp::Schema::BaseClass';

1;

So, now I get records in the same table but distinguished based on
what result source they come from.  This works fine with the latest
CPAN release of DBIC (0.08010) but when I try to run the same code
against trunk I get this exception:

Column rel_source not loaded on Test trying to resolve relationship at
t/schema.t line 39

Is this change of behavior expected, or is this possibly a regression?
 If it's a regression I'll write up a test case and hopefully get to
the bottom of it... if not, could someone clue me in? :)

Thanks,
-J

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co=
.uk

*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*=
"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*=
"*
Notice: This e-mail contains information that is confidential and may be pr=
ivileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*=
"*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20081121/512=
ef586/attachment.htm


More information about the DBIx-Class mailing list