From: Christian Walde Date: Fri, 1 Mar 2013 14:07:57 +0000 (+0100) Subject: rename occurences of belongs_to in tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f54cb4d66292431efc26b4d14b22ebf9228cc7b9;p=dbsrgits%2FDBIx-Class.git rename occurences of belongs_to in tests --- diff --git a/t/101populate_rs.t b/t/101populate_rs.t index 46368f3..d6304c7 100644 --- a/t/101populate_rs.t +++ b/t/101populate_rs.t @@ -2,7 +2,7 @@ ## Tests for the $resultset->populate method. ## ## GOALS: We need to test the method for both void and array context for all -## the following relationship types: belongs_to, has_many. Additionally we +## the following relationship types: refers_to, has_many. Additionally we ## need to test each of those for both specified PK's and autogenerated PK's ## ## Also need to test some stuff that should generate errors. @@ -272,7 +272,7 @@ ARRAY_CONTEXT: { BELONGS_TO_NO_PKs: { - ## Test from a belongs_to perspective, should create artist first, + ## Test from a refers_to perspective, should create artist first, ## then CD with artistid. This test we let the system automatically ## create the PK's. Chances are good you'll use it this way mostly. @@ -304,7 +304,7 @@ ARRAY_CONTEXT: { BELONGS_TO_WITH_PKs: { - ## Test from a belongs_to perspective, should create artist first, + ## Test from a refers_to perspective, should create artist first, ## then CD with artistid. This time we try setting the PK's my $aid = $art_rs->get_column('artistid')->max || 0; @@ -455,7 +455,7 @@ VOID_CONTEXT: { BELONGS_TO_WITH_PKs: { - ## Test from a belongs_to perspective, should create artist first, + ## Test from a refers_to perspective, should create artist first, ## then CD with artistid. This time we try setting the PK's my $aid = $art_rs->get_column('artistid')->max || 0; @@ -492,7 +492,7 @@ VOID_CONTEXT: { BELONGS_TO_NO_PKs: { - ## Test from a belongs_to perspective, should create artist first, + ## Test from a refers_to perspective, should create artist first, ## then CD with artistid. my $cds = [ diff --git a/t/103many_to_many_warning.t b/t/103many_to_many_warning.t index f2944b4..2626197 100644 --- a/t/103many_to_many_warning.t +++ b/t/103many_to_many_warning.t @@ -74,8 +74,8 @@ use warnings; data_type => 'integer', }, ); - __PACKAGE__->belongs_to('foo' => 'DBICTest::Schema::Foo${suffix}'); - __PACKAGE__->belongs_to('bar' => 'DBICTest::Schema::Foo${suffix}'); + __PACKAGE__->refers_to('foo' => 'DBICTest::Schema::Foo${suffix}'); + __PACKAGE__->refers_to('bar' => 'DBICTest::Schema::Foo${suffix}'); } { package # diff --git a/t/71mysql.t b/t/71mysql.t index de1e2fd..31990d9 100644 --- a/t/71mysql.t +++ b/t/71mysql.t @@ -158,7 +158,7 @@ $schema->populate ('BooksInLibrary', [ is ($_->count, 2, 'Prefetched grouped search returns correct count'); } - # try a ->belongs_to direction (no select collapse) + # try a ->refers_to direction (no select collapse) my $books = $schema->resultset ('BooksInLibrary')->search ( { 'owner.name' => 'wiggle' }, { prefetch => 'owner', distinct => 1 } diff --git a/t/73oracle_hq.t b/t/73oracle_hq.t index 8189479..f219f85 100644 --- a/t/73oracle_hq.t +++ b/t/73oracle_hq.t @@ -33,7 +33,7 @@ BEGIN { { 'foreign.parentid' => 'self.artistid' } ); - DBICTest::Schema::Artist->belongs_to( + DBICTest::Schema::Artist->refers_to( parent => 'DBICTest::Schema::Artist', { 'foreign.artistid' => 'self.parentid' } ); diff --git a/t/746mssql.t b/t/746mssql.t index b822138..4de9725 100644 --- a/t/746mssql.t +++ b/t/746mssql.t @@ -406,7 +406,7 @@ SQL } - # try a ->belongs_to direction (no select collapse, group_by should work) + # try a ->refers_to direction (no select collapse, group_by should work) my $books = $schema->resultset ('BooksInLibrary')->search ( { 'owner.name' => [qw/wiggle woggle/], diff --git a/t/inflate/hri.t b/t/inflate/hri.t index eaf9128..63a91f9 100644 --- a/t/inflate/hri.t +++ b/t/inflate/hri.t @@ -78,7 +78,7 @@ sub check_cols_of { if (not ref ($datahashref->{$col}) ) { is ($datahashref->{$col}, $dbic_obj->get_column($col), 'same value'); } - # related table entry (belongs_to) + # related table entry (refers_to) elsif (ref ($datahashref->{$col}) eq 'HASH') { check_cols_of($dbic_obj->$col, $datahashref->{$col}); } diff --git a/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm b/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm index facc1a2..1dea709 100644 --- a/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm +++ b/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm @@ -13,8 +13,8 @@ __PACKAGE__->add_columns( ); __PACKAGE__->set_primary_key(qw/id1 id2/); -__PACKAGE__->belongs_to( 'artist1', 'DBICTest::Schema::Artist', 'id1', { on_delete => 'RESTRICT', on_update => 'CASCADE'} ); -__PACKAGE__->belongs_to( 'artist2', 'DBICTest::Schema::Artist', 'id2', { on_delete => undef, on_update => undef} ); +__PACKAGE__->refers_to( 'artist1', 'DBICTest::Schema::Artist', 'id1', { on_delete => 'RESTRICT', on_update => 'CASCADE'} ); +__PACKAGE__->refers_to( 'artist2', 'DBICTest::Schema::Artist', 'id2', { on_delete => undef, on_update => undef} ); __PACKAGE__->has_many( 'mapped_artists', 'DBICTest::Schema::Artist', [ {'foreign.artistid' => 'self.id1'}, {'foreign.artistid' => 'self.id2'} ], diff --git a/t/lib/DBICTest/Schema/Artwork.pm b/t/lib/DBICTest/Schema/Artwork.pm index 01ce450..28a4604 100644 --- a/t/lib/DBICTest/Schema/Artwork.pm +++ b/t/lib/DBICTest/Schema/Artwork.pm @@ -15,7 +15,7 @@ __PACKAGE__->add_columns( }, ); __PACKAGE__->set_primary_key('cd_id'); -__PACKAGE__->belongs_to('cd', 'DBICTest::Schema::CD', 'cd_id'); +__PACKAGE__->refers_to('cd', 'DBICTest::Schema::CD', 'cd_id'); __PACKAGE__->has_many('images', 'DBICTest::Schema::Image', 'artwork_id'); __PACKAGE__->has_many('artwork_to_artist', 'DBICTest::Schema::Artwork_to_Artist', 'artwork_cd_id'); diff --git a/t/lib/DBICTest/Schema/Artwork_to_Artist.pm b/t/lib/DBICTest/Schema/Artwork_to_Artist.pm index 57326e2..3a94629 100644 --- a/t/lib/DBICTest/Schema/Artwork_to_Artist.pm +++ b/t/lib/DBICTest/Schema/Artwork_to_Artist.pm @@ -19,10 +19,10 @@ __PACKAGE__->add_columns( }, ); __PACKAGE__->set_primary_key(qw/artwork_cd_id artist_id/); -__PACKAGE__->belongs_to('artwork', 'DBICTest::Schema::Artwork', 'artwork_cd_id'); -__PACKAGE__->belongs_to('artist', 'DBICTest::Schema::Artist', 'artist_id'); +__PACKAGE__->refers_to('artwork', 'DBICTest::Schema::Artwork', 'artwork_cd_id'); +__PACKAGE__->refers_to('artist', 'DBICTest::Schema::Artist', 'artist_id'); -__PACKAGE__->belongs_to('artist_test_m2m', 'DBICTest::Schema::Artist', +__PACKAGE__->refers_to('artist_test_m2m', 'DBICTest::Schema::Artist', sub { my $args = shift; @@ -46,7 +46,7 @@ __PACKAGE__->belongs_to('artist_test_m2m', 'DBICTest::Schema::Artist', } ); -__PACKAGE__->belongs_to('artist_test_m2m_noopt', 'DBICTest::Schema::Artist', +__PACKAGE__->refers_to('artist_test_m2m_noopt', 'DBICTest::Schema::Artist', sub { my $args = shift; diff --git a/t/lib/DBICTest/Schema/Bookmark.pm b/t/lib/DBICTest/Schema/Bookmark.pm index 40cfa3f..46086b0 100644 --- a/t/lib/DBICTest/Schema/Bookmark.pm +++ b/t/lib/DBICTest/Schema/Bookmark.pm @@ -21,7 +21,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); require DBICTest::Schema::Link; # so we can get a columnlist -__PACKAGE__->belongs_to( +__PACKAGE__->refers_to( link => 'DBICTest::Schema::Link', 'link', { on_delete => 'SET NULL', join_type => 'LEFT', diff --git a/t/lib/DBICTest/Schema/BooksInLibrary.pm b/t/lib/DBICTest/Schema/BooksInLibrary.pm index cd6f375..a4efd7e 100644 --- a/t/lib/DBICTest/Schema/BooksInLibrary.pm +++ b/t/lib/DBICTest/Schema/BooksInLibrary.pm @@ -34,6 +34,6 @@ __PACKAGE__->add_unique_constraint (['title']); __PACKAGE__->resultset_attributes({where => { source => "Library" } }); -__PACKAGE__->belongs_to ( owner => 'DBICTest::Schema::Owners', 'owner' ); +__PACKAGE__->refers_to ( owner => 'DBICTest::Schema::Owners', 'owner' ); 1; diff --git a/t/lib/DBICTest/Schema/CD.pm b/t/lib/DBICTest/Schema/CD.pm index d10b6be..13773ac 100644 --- a/t/lib/DBICTest/Schema/CD.pm +++ b/t/lib/DBICTest/Schema/CD.pm @@ -40,16 +40,16 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('cdid'); __PACKAGE__->add_unique_constraint([ qw/artist title/ ]); -__PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist', undef, { +__PACKAGE__->refers_to( artist => 'DBICTest::Schema::Artist', undef, { is_deferrable => 1, proxy => { artist_name => 'name' }, }); -__PACKAGE__->belongs_to( very_long_artist_relationship => 'DBICTest::Schema::Artist', 'artist', { +__PACKAGE__->refers_to( very_long_artist_relationship => 'DBICTest::Schema::Artist', 'artist', { is_deferrable => 1, }); # in case this is a single-cd it promotes a track from another cd -__PACKAGE__->belongs_to( single_track => 'DBICTest::Schema::Track', 'single_track', +__PACKAGE__->refers_to( single_track => 'DBICTest::Schema::Track', 'single_track', { join_type => 'left'} ); @@ -75,7 +75,7 @@ __PACKAGE__->many_to_many( { order_by => 'producer.name' }, ); -__PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre', +__PACKAGE__->refers_to('genre', 'DBICTest::Schema::Genre', { 'foreign.genreid' => 'self.genreid' }, { join_type => 'left', @@ -86,7 +86,7 @@ __PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre', #This second relationship was added to test the short-circuiting of pointless #queries provided by undef_on_null_fk. the relevant test in 66relationship.t -__PACKAGE__->belongs_to('genre_inefficient', 'DBICTest::Schema::Genre', +__PACKAGE__->refers_to('genre_inefficient', 'DBICTest::Schema::Genre', { 'foreign.genreid' => 'self.genreid' }, { join_type => 'left', diff --git a/t/lib/DBICTest/Schema/CD_to_Producer.pm b/t/lib/DBICTest/Schema/CD_to_Producer.pm index b416797..a8af0e8 100644 --- a/t/lib/DBICTest/Schema/CD_to_Producer.pm +++ b/t/lib/DBICTest/Schema/CD_to_Producer.pm @@ -14,12 +14,12 @@ __PACKAGE__->add_columns( ); __PACKAGE__->set_primary_key(qw/cd producer/); -__PACKAGE__->belongs_to( +__PACKAGE__->refers_to( 'cd', 'DBICTest::Schema::CD', { 'foreign.cdid' => 'self.cd' } ); -__PACKAGE__->belongs_to( +__PACKAGE__->refers_to( 'producer', 'DBICTest::Schema::Producer', { 'foreign.producerid' => 'self.producer' }, { on_delete => undef, on_update => undef }, diff --git a/t/lib/DBICTest/Schema/CollectionObject.pm b/t/lib/DBICTest/Schema/CollectionObject.pm index 1a013e0..c26644d 100644 --- a/t/lib/DBICTest/Schema/CollectionObject.pm +++ b/t/lib/DBICTest/Schema/CollectionObject.pm @@ -17,10 +17,10 @@ __PACKAGE__->add_columns( ); __PACKAGE__->set_primary_key(qw/collection object/); -__PACKAGE__->belongs_to( collection => "DBICTest::Schema::Collection", +__PACKAGE__->refers_to( collection => "DBICTest::Schema::Collection", { "foreign.collectionid" => "self.collection" } ); -__PACKAGE__->belongs_to( object => "DBICTest::Schema::TypedObject", +__PACKAGE__->refers_to( object => "DBICTest::Schema::TypedObject", { "foreign.objectid" => "self.object" } ); diff --git a/t/lib/DBICTest/Schema/Employee.pm b/t/lib/DBICTest/Schema/Employee.pm index dde6fd3..bd07d14 100644 --- a/t/lib/DBICTest/Schema/Employee.pm +++ b/t/lib/DBICTest/Schema/Employee.pm @@ -47,7 +47,7 @@ __PACKAGE__->position_column('position'); # Do not add unique constraints here - different groups are used throughout # the ordered tests -__PACKAGE__->belongs_to (secretkey => 'DBICTest::Schema::Encoded', 'encoded', { +__PACKAGE__->refers_to (secretkey => 'DBICTest::Schema::Encoded', 'encoded', { join_type => 'left' }); diff --git a/t/lib/DBICTest/Schema/ForceForeign.pm b/t/lib/DBICTest/Schema/ForceForeign.pm index a870f3e..f7c7870 100644 --- a/t/lib/DBICTest/Schema/ForceForeign.pm +++ b/t/lib/DBICTest/Schema/ForceForeign.pm @@ -27,7 +27,7 @@ __PACKAGE__->might_have('cd_1', 'DBICTest::Schema::CD', ); # Normally this would appear as a FK constraint -__PACKAGE__->belongs_to('cd_3', 'DBICTest::Schema::CD', +__PACKAGE__->refers_to('cd_3', 'DBICTest::Schema::CD', { 'foreign.cdid' => 'self.cd' }, { is_foreign_key_constraint => 0 }, ); diff --git a/t/lib/DBICTest/Schema/FourKeys_to_TwoKeys.pm b/t/lib/DBICTest/Schema/FourKeys_to_TwoKeys.pm index a208135..d09215f 100644 --- a/t/lib/DBICTest/Schema/FourKeys_to_TwoKeys.pm +++ b/t/lib/DBICTest/Schema/FourKeys_to_TwoKeys.pm @@ -21,14 +21,14 @@ __PACKAGE__->set_primary_key( qw/f_foo f_bar f_hello f_goodbye t_artist t_cd/ ); -__PACKAGE__->belongs_to('fourkeys', 'DBICTest::Schema::FourKeys', { +__PACKAGE__->refers_to('fourkeys', 'DBICTest::Schema::FourKeys', { 'foreign.foo' => 'self.f_foo', 'foreign.bar' => 'self.f_bar', 'foreign.hello' => 'self.f_hello', 'foreign.goodbye' => 'self.f_goodbye', }); -__PACKAGE__->belongs_to('twokeys', 'DBICTest::Schema::TwoKeys', { +__PACKAGE__->refers_to('twokeys', 'DBICTest::Schema::TwoKeys', { 'foreign.artist' => 'self.t_artist', 'foreign.cd' => 'self.t_cd', }); diff --git a/t/lib/DBICTest/Schema/Image.pm b/t/lib/DBICTest/Schema/Image.pm index bfaf7eb..3ccc113 100644 --- a/t/lib/DBICTest/Schema/Image.pm +++ b/t/lib/DBICTest/Schema/Image.pm @@ -26,6 +26,6 @@ __PACKAGE__->add_columns( }, ); __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to('artwork', 'DBICTest::Schema::Artwork', 'artwork_id'); +__PACKAGE__->refers_to('artwork', 'DBICTest::Schema::Artwork', 'artwork_id'); 1; diff --git a/t/lib/DBICTest/Schema/LinerNotes.pm b/t/lib/DBICTest/Schema/LinerNotes.pm index 6c75f25..dee08c4 100644 --- a/t/lib/DBICTest/Schema/LinerNotes.pm +++ b/t/lib/DBICTest/Schema/LinerNotes.pm @@ -17,7 +17,7 @@ __PACKAGE__->add_columns( }, ); __PACKAGE__->set_primary_key('liner_id'); -__PACKAGE__->belongs_to( +__PACKAGE__->refers_to( 'cd', 'DBICTest::Schema::CD', 'liner_id' ); diff --git a/t/lib/DBICTest/Schema/LyricVersion.pm b/t/lib/DBICTest/Schema/LyricVersion.pm index fb55738..471ba14 100644 --- a/t/lib/DBICTest/Schema/LyricVersion.pm +++ b/t/lib/DBICTest/Schema/LyricVersion.pm @@ -22,6 +22,6 @@ __PACKAGE__->add_columns( }, ); __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to('lyric', 'DBICTest::Schema::Lyrics', 'lyric_id'); +__PACKAGE__->refers_to('lyric', 'DBICTest::Schema::Lyrics', 'lyric_id'); 1; diff --git a/t/lib/DBICTest/Schema/Lyrics.pm b/t/lib/DBICTest/Schema/Lyrics.pm index bb0a56b..f45d0bb 100644 --- a/t/lib/DBICTest/Schema/Lyrics.pm +++ b/t/lib/DBICTest/Schema/Lyrics.pm @@ -18,7 +18,7 @@ __PACKAGE__->add_columns( }, ); __PACKAGE__->set_primary_key('lyric_id'); -__PACKAGE__->belongs_to('track', 'DBICTest::Schema::Track', 'track_id'); +__PACKAGE__->refers_to('track', 'DBICTest::Schema::Track', 'track_id'); __PACKAGE__->has_many('lyric_versions', 'DBICTest::Schema::LyricVersion', 'lyric_id'); 1; diff --git a/t/lib/DBICTest/Schema/SelfRefAlias.pm b/t/lib/DBICTest/Schema/SelfRefAlias.pm index aaf453e..b376520 100644 --- a/t/lib/DBICTest/Schema/SelfRefAlias.pm +++ b/t/lib/DBICTest/Schema/SelfRefAlias.pm @@ -17,7 +17,7 @@ __PACKAGE__->add_columns( ); __PACKAGE__->set_primary_key(qw/self_ref alias/); -__PACKAGE__->belongs_to( self_ref => 'DBICTest::Schema::SelfRef' ); -__PACKAGE__->belongs_to( alias => 'DBICTest::Schema::SelfRef' ); +__PACKAGE__->refers_to( self_ref => 'DBICTest::Schema::SelfRef' ); +__PACKAGE__->refers_to( alias => 'DBICTest::Schema::SelfRef' ); 1; diff --git a/t/lib/DBICTest/Schema/Tag.pm b/t/lib/DBICTest/Schema/Tag.pm index 40bd945..4f72e4c 100644 --- a/t/lib/DBICTest/Schema/Tag.pm +++ b/t/lib/DBICTest/Schema/Tag.pm @@ -31,7 +31,7 @@ __PACKAGE__->add_unique_constraints( # do not remove, part of a test [qw/ tagid tag cd /], ); -__PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD', 'cd', { +__PACKAGE__->refers_to( cd => 'DBICTest::Schema::CD', 'cd', { proxy => [ 'year', { cd_title => 'title' } ], }); diff --git a/t/lib/DBICTest/Schema/Track.pm b/t/lib/DBICTest/Schema/Track.pm index b82545a..6f99c4d 100644 --- a/t/lib/DBICTest/Schema/Track.pm +++ b/t/lib/DBICTest/Schema/Track.pm @@ -49,23 +49,23 @@ __PACKAGE__->position_column ('position'); __PACKAGE__->grouping_column ('cd'); -__PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD', undef, { +__PACKAGE__->refers_to( cd => 'DBICTest::Schema::CD', undef, { proxy => { cd_title => 'title' }, }); -__PACKAGE__->belongs_to( disc => 'DBICTest::Schema::CD' => 'cd', { +__PACKAGE__->refers_to( disc => 'DBICTest::Schema::CD' => 'cd', { proxy => 'year' }); __PACKAGE__->might_have( cd_single => 'DBICTest::Schema::CD', 'single_track' ); __PACKAGE__->might_have( lyrics => 'DBICTest::Schema::Lyrics', 'track_id' ); -__PACKAGE__->belongs_to( +__PACKAGE__->refers_to( "year1999cd", "DBICTest::Schema::Year1999CDs", { "foreign.cdid" => "self.cd" }, { join_type => 'left' }, # the relationship is of course optional ); -__PACKAGE__->belongs_to( +__PACKAGE__->refers_to( "year2000cd", "DBICTest::Schema::Year2000CDs", { "foreign.cdid" => "self.cd" }, diff --git a/t/lib/DBICTest/Schema/TreeLike.pm b/t/lib/DBICTest/Schema/TreeLike.pm index 853bfe6..c06ab01 100644 --- a/t/lib/DBICTest/Schema/TreeLike.pm +++ b/t/lib/DBICTest/Schema/TreeLike.pm @@ -15,7 +15,7 @@ __PACKAGE__->add_columns( }, ); __PACKAGE__->set_primary_key(qw/id/); -__PACKAGE__->belongs_to('parent', 'TreeLike', +__PACKAGE__->refers_to('parent', 'TreeLike', { 'foreign.id' => 'self.parent' }); __PACKAGE__->has_many('children', 'TreeLike', { 'foreign.parent' => 'self.id' }); diff --git a/t/lib/DBICTest/Schema/TwoKeyTreeLike.pm b/t/lib/DBICTest/Schema/TwoKeyTreeLike.pm index b28fc48..56db459 100644 --- a/t/lib/DBICTest/Schema/TwoKeyTreeLike.pm +++ b/t/lib/DBICTest/Schema/TwoKeyTreeLike.pm @@ -18,7 +18,7 @@ __PACKAGE__->add_columns( ); __PACKAGE__->set_primary_key(qw/id1 id2/); __PACKAGE__->add_unique_constraint('tktlnameunique' => ['name']); -__PACKAGE__->belongs_to('parent', 'DBICTest::Schema::TwoKeyTreeLike', +__PACKAGE__->refers_to('parent', 'DBICTest::Schema::TwoKeyTreeLike', { 'foreign.id1' => 'self.parent1', 'foreign.id2' => 'self.parent2'}); 1; diff --git a/t/lib/DBICTest/Schema/TwoKeys.pm b/t/lib/DBICTest/Schema/TwoKeys.pm index ff8f980..40e4af4 100644 --- a/t/lib/DBICTest/Schema/TwoKeys.pm +++ b/t/lib/DBICTest/Schema/TwoKeys.pm @@ -13,12 +13,12 @@ __PACKAGE__->add_columns( ); __PACKAGE__->set_primary_key(qw/artist cd/); -__PACKAGE__->belongs_to( +__PACKAGE__->refers_to( artist => 'DBICTest::Schema::Artist', {'foreign.artistid'=>'self.artist'}, ); -__PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD', undef, { is_deferrable => 0, add_fk_index => 0 } ); +__PACKAGE__->refers_to( cd => 'DBICTest::Schema::CD', undef, { is_deferrable => 0, add_fk_index => 0 } ); __PACKAGE__->has_many( 'fourkeys_to_twokeys', 'DBICTest::Schema::FourKeys_to_TwoKeys', { diff --git a/t/lib/DBICTest/Schema/Year1999CDs.pm b/t/lib/DBICTest/Schema/Year1999CDs.pm index e13f044..0f6377a 100644 --- a/t/lib/DBICTest/Schema/Year1999CDs.pm +++ b/t/lib/DBICTest/Schema/Year1999CDs.pm @@ -35,7 +35,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('cdid'); __PACKAGE__->add_unique_constraint([ qw/artist title/ ]); -__PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist' ); +__PACKAGE__->refers_to( artist => 'DBICTest::Schema::Artist' ); __PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track', { "foreign.cd" => "self.cdid" }); diff --git a/t/lib/DBICTest/Schema/Year2000CDs.pm b/t/lib/DBICTest/Schema/Year2000CDs.pm index f0890a3..204dc11 100644 --- a/t/lib/DBICTest/Schema/Year2000CDs.pm +++ b/t/lib/DBICTest/Schema/Year2000CDs.pm @@ -15,7 +15,7 @@ __PACKAGE__->result_source_instance->view_definition( sprintf ( join (', ', __PACKAGE__->columns), )); -__PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist' ); +__PACKAGE__->refers_to( artist => 'DBICTest::Schema::Artist' ); __PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track', { "foreign.cd" => "self.cdid" }); diff --git a/t/lib/PrefetchBug/LeftRight.pm b/t/lib/PrefetchBug/LeftRight.pm index 8ac1362..997086a 100644 --- a/t/lib/PrefetchBug/LeftRight.pm +++ b/t/lib/PrefetchBug/LeftRight.pm @@ -13,8 +13,8 @@ __PACKAGE__->add_columns( value => {}); __PACKAGE__->set_primary_key('left_id', 'right_id'); -__PACKAGE__->belongs_to(left => 'PrefetchBug::Left', 'left_id'); -__PACKAGE__->belongs_to( +__PACKAGE__->refers_to(left => 'PrefetchBug::Left', 'left_id'); +__PACKAGE__->refers_to( right => 'PrefetchBug::Right', 'right_id', # {join_type => 'left'} diff --git a/t/lib/ViewDeps/Result/Artwork.pm b/t/lib/ViewDeps/Result/Artwork.pm index 056bdb8..c1cc2a0 100644 --- a/t/lib/ViewDeps/Result/Artwork.pm +++ b/t/lib/ViewDeps/Result/Artwork.pm @@ -15,7 +15,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( 'cd', 'ViewDeps::Result::CD', +__PACKAGE__->refers_to( 'cd', 'ViewDeps::Result::CD', { "foreign.id" => "self.cd" }, ); diff --git a/t/lib/ViewDeps/Result/CD.pm b/t/lib/ViewDeps/Result/CD.pm index c69f4b3..8bb7f5d 100644 --- a/t/lib/ViewDeps/Result/CD.pm +++ b/t/lib/ViewDeps/Result/CD.pm @@ -17,7 +17,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( 'artist', 'ViewDeps::Result::Artist', +__PACKAGE__->refers_to( 'artist', 'ViewDeps::Result::Artist', { "foreign.id" => "self.artist" }, ); diff --git a/t/lib/ViewDeps/Result/Track.pm b/t/lib/ViewDeps/Result/Track.pm index 62b1b99..f1f2fdc 100644 --- a/t/lib/ViewDeps/Result/Track.pm +++ b/t/lib/ViewDeps/Result/Track.pm @@ -16,7 +16,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( 'cd', 'ViewDeps::Result::CD', +__PACKAGE__->refers_to( 'cd', 'ViewDeps::Result::CD', { "foreign.id" => "self.cd" }, ); diff --git a/t/lib/ViewDeps/Result/TrackNumberFives.pm b/t/lib/ViewDeps/Result/TrackNumberFives.pm index fc4a47b..5c7225d 100644 --- a/t/lib/ViewDeps/Result/TrackNumberFives.pm +++ b/t/lib/ViewDeps/Result/TrackNumberFives.pm @@ -19,7 +19,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( 'cd', 'ViewDeps::Result::CD', +__PACKAGE__->refers_to( 'cd', 'ViewDeps::Result::CD', { "foreign.id" => "self.cd" }, ); diff --git a/t/lib/ViewDeps/Result/Year2010CDs.pm b/t/lib/ViewDeps/Result/Year2010CDs.pm index 2706fae..b681390 100644 --- a/t/lib/ViewDeps/Result/Year2010CDs.pm +++ b/t/lib/ViewDeps/Result/Year2010CDs.pm @@ -20,7 +20,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( 'artist', 'ViewDeps::Result::Artist', +__PACKAGE__->refers_to( 'artist', 'ViewDeps::Result::Artist', { "foreign.id" => "self.artist" }, ); diff --git a/t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm b/t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm index c6e4144..a7688db 100644 --- a/t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm +++ b/t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm @@ -25,7 +25,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( 'artist', 'ViewDeps::Result::Artist', +__PACKAGE__->refers_to( 'artist', 'ViewDeps::Result::Artist', { "foreign.id" => "self.artist" }, ); diff --git a/t/lib/ViewDepsBad/Result/Artwork.pm b/t/lib/ViewDepsBad/Result/Artwork.pm index 978e196..8e25940 100644 --- a/t/lib/ViewDepsBad/Result/Artwork.pm +++ b/t/lib/ViewDepsBad/Result/Artwork.pm @@ -15,7 +15,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( 'cd', 'ViewDepsBad::Result::CD', +__PACKAGE__->refers_to( 'cd', 'ViewDepsBad::Result::CD', { "foreign.id" => "self.cd" }, ); diff --git a/t/lib/ViewDepsBad/Result/CD.pm b/t/lib/ViewDepsBad/Result/CD.pm index ea40b84..fabb804 100644 --- a/t/lib/ViewDepsBad/Result/CD.pm +++ b/t/lib/ViewDepsBad/Result/CD.pm @@ -17,7 +17,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( 'artist', 'ViewDepsBad::Result::Artist', +__PACKAGE__->refers_to( 'artist', 'ViewDepsBad::Result::Artist', { "foreign.id" => "self.artist" }, ); diff --git a/t/lib/ViewDepsBad/Result/Track.pm b/t/lib/ViewDepsBad/Result/Track.pm index 0ff97f2..fb8fdc3 100644 --- a/t/lib/ViewDepsBad/Result/Track.pm +++ b/t/lib/ViewDepsBad/Result/Track.pm @@ -16,7 +16,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( 'cd', 'ViewDepsBad::Result::CD', +__PACKAGE__->refers_to( 'cd', 'ViewDepsBad::Result::CD', { "foreign.id" => "self.cd" }, ); diff --git a/t/lib/ViewDepsBad/Result/TrackNumberFives.pm b/t/lib/ViewDepsBad/Result/TrackNumberFives.pm index ce09b80..b8f1115 100644 --- a/t/lib/ViewDepsBad/Result/TrackNumberFives.pm +++ b/t/lib/ViewDepsBad/Result/TrackNumberFives.pm @@ -19,7 +19,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( 'cd', 'ViewDepsBad::Result::CD', +__PACKAGE__->refers_to( 'cd', 'ViewDepsBad::Result::CD', { "foreign.id" => "self.cd" }, ); diff --git a/t/lib/ViewDepsBad/Result/Year2010CDs.pm b/t/lib/ViewDepsBad/Result/Year2010CDs.pm index 8771ad9..9285922 100644 --- a/t/lib/ViewDepsBad/Result/Year2010CDs.pm +++ b/t/lib/ViewDepsBad/Result/Year2010CDs.pm @@ -20,7 +20,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( 'artist', 'ViewDepsBad::Result::Artist', +__PACKAGE__->refers_to( 'artist', 'ViewDepsBad::Result::Artist', { "foreign.id" => "self.artist" }, ); diff --git a/t/lib/ViewDepsBad/Result/Year2010CDsWithManyTracks.pm b/t/lib/ViewDepsBad/Result/Year2010CDsWithManyTracks.pm index 9a4900f..6f8e561 100644 --- a/t/lib/ViewDepsBad/Result/Year2010CDsWithManyTracks.pm +++ b/t/lib/ViewDepsBad/Result/Year2010CDsWithManyTracks.pm @@ -25,7 +25,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( 'artist', 'ViewDepsBad::Result::Artist', +__PACKAGE__->refers_to( 'artist', 'ViewDepsBad::Result::Artist', { "foreign.id" => "self.artist" }, ); diff --git a/t/multi_create/diamond.t b/t/multi_create/diamond.t index 499f7a1..b700373 100644 --- a/t/multi_create/diamond.t +++ b/t/multi_create/diamond.t @@ -13,9 +13,9 @@ my $schema = DBICTest->init_schema(); mc_diag (<<'DG'); * Try a diamond multicreate -Artist -> has_many -> Artwork_to_Artist -> belongs_to +Artist -> has_many -> Artwork_to_Artist -> refers_to / - belongs_to <- CD <- belongs_to <- Artwork <-/ + refers_to <- CD <- refers_to <- Artwork <-/ \ \-> Artist2 diff --git a/t/multi_create/in_memory.t b/t/multi_create/in_memory.t index 25d290a..c2c83eb 100644 --- a/t/multi_create/in_memory.t +++ b/t/multi_create/in_memory.t @@ -74,7 +74,7 @@ my $schema = DBICTest->init_schema(); # test both sides of a 1:(1|0) { - for my $reldir ('might_have', 'belongs_to') { + for my $reldir ('might_have', 'refers_to') { my $artist = $schema->resultset('Artist')->next; my $new_track = $schema->resultset('Track')->new ({ diff --git a/t/multi_create/standard.t b/t/multi_create/standard.t index 6eb2b9a..2f4e53d 100644 --- a/t/multi_create/standard.t +++ b/t/multi_create/standard.t @@ -22,7 +22,7 @@ lives_ok ( sub { isa_ok($cd, 'DBICTest::CD', 'Created CD object'); isa_ok($cd->artist, 'DBICTest::Artist', 'Created related Artist'); is($cd->artist->name, 'Fred Bloggs', 'Artist created correctly'); -}, 'simple create + parent (the stuff $rs belongs_to) ok'); +}, 'simple create + parent (the stuff $rs refers_to) ok'); lives_ok ( sub { my $bm_rs = $schema->resultset('Bookmark'); diff --git a/t/prefetch/diamond.t b/t/prefetch/diamond.t index f7a21e0..c225b4b 100644 --- a/t/prefetch/diamond.t +++ b/t/prefetch/diamond.t @@ -28,7 +28,7 @@ my $ars = $schema->resultset ('Artwork'); # V V # cd ------> artist # -# The current artwork belongs to a cd by artist1 +# The current artwork refers to a cd by artist1 # but the artwork itself is painted by artist2 # # What we try is all possible permutations of join/prefetch diff --git a/t/prefetch/grouped.t b/t/prefetch/grouped.t index ffe94b8..d5a1b2c 100644 --- a/t/prefetch/grouped.t +++ b/t/prefetch/grouped.t @@ -24,7 +24,7 @@ for ($cd_rs->all) { is ($_->tracks->count, 3, '3 tracks for CD' . $_->id ); } -# Test a belongs_to prefetch of a has_many +# Test a refers_to prefetch of a has_many { my $track_rs = $schema->resultset ('Track')->search ( { 'me.cd' => { -in => [ $cd_rs->get_column ('cdid')->all ] } }, diff --git a/t/prefetch/join_type.t b/t/prefetch/join_type.t index 380dc0f..a367257 100644 --- a/t/prefetch/join_type.t +++ b/t/prefetch/join_type.t @@ -9,7 +9,7 @@ use DBICTest; my $schema = DBICTest->init_schema(); -# a regular belongs_to prefetch +# a regular refers_to prefetch my $cds = $schema->resultset('CD')->search ({}, { prefetch => 'artist' } ); my $nulls = { diff --git a/t/prefetch/o2m_o2m_order_by_with_limit.t b/t/prefetch/o2m_o2m_order_by_with_limit.t index 76dbb9b..de2e734 100644 --- a/t/prefetch/o2m_o2m_order_by_with_limit.t +++ b/t/prefetch/o2m_o2m_order_by_with_limit.t @@ -61,10 +61,10 @@ is_same_sql_bind( # note: we only requested "get all cds of all artists with rank 13 then order # by the artist name and give me the fourth, fifth and sixth", consequently the -# cds that belong to the same artist are unordered; fortunately we know that +# cds that refer to the same artist are unordered; fortunately we know that # the first artist have 3 cds and the second and third artist both have only -# one, so the first 3 cds belong to the first artist and the fourth and fifth -# cds belong to the second and third artist, respectively, and there's no sixth +# one, so the first 3 cds refer to the first artist and the fourth and fifth +# cds refer to the second and third artist, respectively, and there's no sixth # row is_deeply ( $filtered_cd_rs->all_hri, diff --git a/t/prefetch/standard.t b/t/prefetch/standard.t index 56781be..561dd8a 100644 --- a/t/prefetch/standard.t +++ b/t/prefetch/standard.t @@ -71,9 +71,9 @@ $queries = 0; is($tag->search_related('cd')->search_related('artist')->first->name, 'Caterwauler McCrae', - 'chained belongs_to->belongs_to search_related ok'); + 'chained refers_to->refers_to search_related ok'); -is($queries, 0, 'chained search_related after belontgs_to->belongs_to prefetch ran no queries'); +is($queries, 0, 'chained search_related after refers_to->refers_to prefetch ran no queries'); $queries = 0; diff --git a/t/relationship/core.t b/t/relationship/core.t index 96c5066..5b75e8d 100644 --- a/t/relationship/core.t +++ b/t/relationship/core.t @@ -54,9 +54,9 @@ is( $big_flop_cd->title, 'Big Flop', 'create_related ok' ); $schema->storage->debugcb(sub { $queries++; }); $schema->storage->debug(1); $big_flop_cd->genre; #should not trigger a select query - is($queries, 0, 'No SELECT made for belongs_to if key IS NULL'); + is($queries, 0, 'No SELECT made for refers_to if key IS NULL'); $big_flop_cd->genre_inefficient; #should trigger a select query - is($queries, 1, 'SELECT made for belongs_to if key IS NULL when undef_on_null_fk disabled'); + is($queries, 1, 'SELECT made for refers_to if key IS NULL when undef_on_null_fk disabled'); $schema->storage->debug($sdebug); $schema->storage->debugcb(undef); } @@ -295,7 +295,7 @@ my $trackset = $artist->cds->search_related('tracks'); is($trackset->count, 10, "Correct number of tracks for artist"); is($trackset->all, 10, "Correct number of track objects for artist"); -# now see about updating eveything that belongs to artist 2 to artist 3 +# now see about updating eveything that refers to artist 2 to artist 3 $artist = $schema->resultset("Artist")->find(2); my $nartist = $schema->resultset("Artist")->find(3); cmp_ok($artist->cds->count, '==', 1, "Correct orig #cds for artist"); @@ -307,14 +307,14 @@ cmp_ok($nartist->cds->count, '==', 2, "Correct new #cds for artist"); # check if is_foreign_key_constraint attr is set my $rs_normal = $schema->source('Track'); my $relinfo = $rs_normal->relationship_info ('cd'); -cmp_ok($relinfo->{attrs}{is_foreign_key_constraint}, '==', 1, "is_foreign_key_constraint defined for belongs_to relationships."); +cmp_ok($relinfo->{attrs}{is_foreign_key_constraint}, '==', 1, "is_foreign_key_constraint defined for refers_to relationships."); my $rs_overridden = $schema->source('ForceForeign'); my $relinfo_with_attr = $rs_overridden->relationship_info ('cd_3'); -cmp_ok($relinfo_with_attr->{attrs}{is_foreign_key_constraint}, '==', 0, "is_foreign_key_constraint defined for belongs_to relationships with attr."); +cmp_ok($relinfo_with_attr->{attrs}{is_foreign_key_constraint}, '==', 0, "is_foreign_key_constraint defined for refers_to relationships with attr."); # check that relationships below left join relationships are forced to left joins -# when traversing multiple belongs_to +# when traversing multiple refers_to my $cds = $schema->resultset("CD")->search({ 'me.cdid' => 5 }, { join => { single_track => 'cd' } }); is($cds->count, 1, "subjoins under left joins force_left (string)"); diff --git a/t/relationship/custom.t b/t/relationship/custom.t index 543c7c0..c47c569 100644 --- a/t/relationship/custom.t +++ b/t/relationship/custom.t @@ -225,10 +225,10 @@ foreach (@artwork_artists) { lives_ok { my $artista = $_->artist; my $artistb = $_->artist_test_m2m; - ok($artista->rank < 10 ? $artistb : 1, 'belongs_to with custom rel works.'); + ok($artista->rank < 10 ? $artistb : 1, 'refers_to with custom rel works.'); my $artistc = $_->artist_test_m2m_noopt; - ok($artista->rank < 10 ? $artistc : 1, 'belongs_to with custom rel works even in non-simplified.'); - } 'belongs_to works with custom rels'; + ok($artista->rank < 10 ? $artistc : 1, 'refers_to with custom rel works even in non-simplified.'); + } 'refers_to works with custom rels'; } @artists = (); diff --git a/t/relationship/info.t b/t/relationship/info.t index 4f349d4..a56f477 100644 --- a/t/relationship/info.t +++ b/t/relationship/info.t @@ -17,7 +17,7 @@ use DBICTest; __PACKAGE__->add_columns(qw/id ancestor_id/); __PACKAGE__->set_primary_key('id'); __PACKAGE__->has_many(children => __PACKAGE__, 'id'); - __PACKAGE__->belongs_to(parent => __PACKAGE__, 'id', { join_type => 'left' } ); + __PACKAGE__->refers_to(parent => __PACKAGE__, 'id', { join_type => 'left' } ); __PACKAGE__->has_many(subthings => 'DBICTest::SubThing', 'thing_id'); } @@ -29,8 +29,8 @@ use DBICTest; use base qw/DBIx::Class::Core/; __PACKAGE__->table('subthing'); __PACKAGE__->add_columns(qw/thing_id/); - __PACKAGE__->belongs_to(thing => 'DBICTest::Thing', 'thing_id'); - __PACKAGE__->belongs_to(thing2 => 'DBICTest::Thing', 'thing_id', { join_type => 'left' } ); + __PACKAGE__->refers_to(thing => 'DBICTest::Thing', 'thing_id'); + __PACKAGE__->refers_to(thing2 => 'DBICTest::Thing', 'thing_id', { join_type => 'left' } ); } my $schema = DBICTest->init_schema; @@ -62,12 +62,12 @@ for my $without_schema (1,0) { is_deeply( _instance($s)->reverse_relationship_info('thing'), { subthings => $t->relationship_info('subthings') }, - 'reverse_rel_info works cross-class belongs_to direction', + 'reverse_rel_info works cross-class refers_to direction', ); is_deeply( _instance($s)->reverse_relationship_info('thing2'), { subthings => $t->relationship_info('subthings') }, - 'reverse_rel_info works cross-class belongs_to direction 2', + 'reverse_rel_info works cross-class refers_to direction 2', ); is_deeply( @@ -79,7 +79,7 @@ for my $without_schema (1,0) { is_deeply( _instance($t)->reverse_relationship_info('parent'), { children => $t->relationship_info('children') }, - 'reverse_rel_info works in-class belongs_to direction', + 'reverse_rel_info works in-class refers_to direction', ); is_deeply( _instance($t)->reverse_relationship_info('children'), diff --git a/t/relationship/set_column_on_fk.t b/t/relationship/set_column_on_fk.t index 9f49427..f2ed46f 100644 --- a/t/relationship/set_column_on_fk.t +++ b/t/relationship/set_column_on_fk.t @@ -24,24 +24,24 @@ my $new_link = $schema->resultset("Link")->create({ is( $bookmark->link->id, 1, 'Initial relation id' ); $bookmark->set_column( 'link', 9 ); -is( $bookmark->link->id, 9, 'Correct object re-selected after belongs_to set' ); +is( $bookmark->link->id, 9, 'Correct object re-selected after refers_to set' ); $bookmark->discard_changes; -is( $bookmark->link->id, 1, 'Pulled the correct old object after belongs_to reset' ); +is( $bookmark->link->id, 1, 'Pulled the correct old object after refers_to reset' ); $bookmark->link($new_link); is( $bookmark->get_column('link'), 9, 'Correct column set from related' ); $bookmark->discard_changes; -is( $bookmark->link->id, 1, 'Pulled the correct old object after belongs_to reset' ); +is( $bookmark->link->id, 1, 'Pulled the correct old object after refers_to reset' ); $bookmark->link(9); is( $bookmark->link->id, 9, 'Correct object selected on deflated accessor set'); $bookmark->discard_changes; -is( $bookmark->link->id, 1, 'Pulled the correct old object after belongs_to reset' ); +is( $bookmark->link->id, 1, 'Pulled the correct old object after refers_to reset' ); $bookmark->update({ link => 9 }); @@ -55,16 +55,16 @@ is( $lyric->track->id, 5, 'Initial relation id'); $lyric->track_id(6); my $track6 = $lyric->track; -is( $track6->trackid, 6, 'Correct object re-selected after belongs_to set'); +is( $track6->trackid, 6, 'Correct object re-selected after refers_to set'); $lyric->discard_changes; -is( $lyric->track->trackid, 5, 'Pulled the correct old rel object after belongs_to reset'); +is( $lyric->track->trackid, 5, 'Pulled the correct old rel object after refers_to reset'); $lyric->track($track6); is( $lyric->track_id, 6, 'Correct column set from related'); $lyric->discard_changes; -is( $lyric->track->trackid, 5, 'Pulled the correct old rel object after belongs_to reset'); +is( $lyric->track->trackid, 5, 'Pulled the correct old rel object after refers_to reset'); $lyric->update({ track => $track6 }); is( $lyric->track->trackid, 6, 'Correct relationship obj after update' );