X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDBICTest%2FSchema%2FTrack.pm;h=5077bd0c983649f52508899cb8b6484a787e8690;hb=a42634cdbf7e969bb9133ff71d2bc2666003d53a;hp=6360ca0a92efe6c9ba9751b12a27976c3f3ece53;hpb=a267ea85dbed950ecd00f5e6a139e33b1a67c7bf;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/lib/DBICTest/Schema/Track.pm b/t/lib/DBICTest/Schema/Track.pm index 6360ca0..5077bd0 100644 --- a/t/lib/DBICTest/Schema/Track.pm +++ b/t/lib/DBICTest/Schema/Track.pm @@ -1,6 +1,9 @@ package # hide from PAUSE DBICTest::Schema::Track; +use warnings; +use strict; + use base qw/DBICTest::BaseResult/; use Carp qw/confess/; @@ -45,7 +48,8 @@ __PACKAGE__->add_unique_constraint([ qw/cd title/ ]); __PACKAGE__->position_column ('position'); __PACKAGE__->grouping_column ('cd'); - +# the undef condition in this rel is *deliberate* +# tests oddball legacy syntax __PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD', undef, { proxy => { cd_title => 'title' }, }); @@ -59,18 +63,18 @@ __PACKAGE__->might_have( lyrics => 'DBICTest::Schema::Lyrics', 'track_id' ); __PACKAGE__->belongs_to( "year1999cd", "DBICTest::Schema::Year1999CDs", - { "foreign.cdid" => "self.cd" }, + 'cd', { join_type => 'left' }, # the relationship is of course optional ); __PACKAGE__->belongs_to( "year2000cd", "DBICTest::Schema::Year2000CDs", - { "foreign.cdid" => "self.cd" }, + 'cd', { join_type => 'left' }, ); -__PACKAGE__->might_have ( - next_track => __PACKAGE__, +__PACKAGE__->has_many ( + next_tracks => __PACKAGE__, sub { my $args = shift; @@ -87,8 +91,8 @@ __PACKAGE__->might_have ( "$args->{foreign_alias}.position" => { '>' => { -ident => "$args->{self_alias}.position" } }, }, $args->{self_rowobj} && { - "$args->{foreign_alias}.cd" => $args->{self_rowobj}->cd, - "$args->{foreign_alias}.position" => { '>' => $args->{self_rowobj}->position }, + "$args->{foreign_alias}.cd" => $args->{self_rowobj}->get_column('cd'), + "$args->{foreign_alias}.position" => { '>' => $args->{self_rowobj}->pos }, } ) }