__PACKAGE__->many_to_many('artists', 'artwork_to_artist', 'artist');
# both to test manytomany with custom rel
-__PACKAGE__->many_to_many('artists_test_m2m', 'artwork_to_artist', 'artist_test_m2m');
-__PACKAGE__->many_to_many('artists_test_m2m_noopt', 'artwork_to_artist', 'artist_test_m2m_noopt');
+# (deliberate misnamed accessor clash)
+__PACKAGE__->many_to_many('artist_limited_rank', 'artwork_to_artist', 'artist_limited_rank');
+__PACKAGE__->many_to_many('artist_limited_rank_opaque', 'artwork_to_artist', 'artist_limited_rank_opaque');
# other test to manytomany
-__PACKAGE__->has_many('artwork_to_artist_test_m2m', 'DBICTest::Schema::Artwork_to_Artist',
+__PACKAGE__->has_many('artwork_to_artist_via_customcond', 'DBICTest::Schema::Artwork_to_Artist',
sub {
# This is for test purposes only. A regular user does not
# need to sanity check the passed-in arguments, this is what
);
}
);
-__PACKAGE__->many_to_many('artists_test_m2m2', 'artwork_to_artist_test_m2m', 'artist');
+__PACKAGE__->many_to_many('artists_via_customcond', 'artwork_to_artist_via_customcond', 'artist');
+
1;
__PACKAGE__->belongs_to('artwork', 'DBICTest::Schema::Artwork', 'artwork_cd_id');
__PACKAGE__->belongs_to('artist', 'DBICTest::Schema::Artist', 'artist_id');
-__PACKAGE__->belongs_to('artist_test_m2m', 'DBICTest::Schema::Artist',
+__PACKAGE__->belongs_to('artist_limited_rank', 'DBICTest::Schema::Artist',
sub {
# This is for test purposes only. A regular user does not
# need to sanity check the passed-in arguments, this is what
}
);
-__PACKAGE__->belongs_to('artist_test_m2m_noopt', 'DBICTest::Schema::Artist',
+__PACKAGE__->belongs_to('artist_limited_rank_opaque', 'DBICTest::Schema::Artist',
sub {
# This is for test purposes only. A regular user does not
# need to sanity check the passed-in arguments, this is what
foreach (@artwork_artists) {
lives_ok {
my $artista = $_->artist;
- my $artistb = $_->artist_test_m2m;
+ my $artistb = $_->artist_limited_rank;
ok($artista->rank < 10 ? $artistb : 1, 'belongs_to with custom rel works.');
- my $artistc = $_->artist_test_m2m_noopt;
+ my $artistc = $_->artist_limited_rank_opaque;
ok($artista->rank < 10 ? $artistc : 1, 'belongs_to with custom rel works even in non-simplified.');
} 'belongs_to works with custom rels';
}
@artists = ();
lives_ok {
- @artists = $artwork->artists_test_m2m2->all;
+ @artists = $artwork->artists_via_customcond->all;
} 'manytomany with extended rels in the has many works';
is(scalar @artists, 2, 'two artists');
@artists = ();
lives_ok {
- @artists = $artwork->artists_test_m2m->all;
+ @artists = $artwork->artist_limited_rank->all;
} 'can fetch many to many with optimized version';
is(scalar @artists, 1, 'only one artist is associated');
@artists = ();
lives_ok {
- @artists = $artwork->artists_test_m2m_noopt->all;
+ @artists = $artwork->artist_limited_rank_opaque->all;
} 'can fetch many to many with non-optimized version';
is(scalar @artists, 1, 'only one artist is associated');