1 package # hide from PAUSE
2 DBICTest::Schema::HelperRels;
4 use base 'DBIx::Class::Core';
6 DBICTest::Schema::Artist->has_many(cds => 'DBICTest::Schema::CD', undef,
7 { order_by => 'year' });
8 DBICTest::Schema::Artist->has_many(twokeys => 'DBICTest::Schema::TwoKeys');
9 DBICTest::Schema::Artist->has_many(onekeys => 'DBICTest::Schema::OneKey');
11 DBICTest::Schema::CD->belongs_to('artist', 'DBICTest::Schema::Artist');
13 DBICTest::Schema::CD->has_many(tracks => 'DBICTest::Schema::Track');
14 DBICTest::Schema::CD->has_many(tags => 'DBICTest::Schema::Tag', undef,
15 { order_by => 'tag' });
16 DBICTest::Schema::CD->has_many(cd_to_producer => 'DBICTest::Schema::CD_to_Producer' => 'cd');
18 DBICTest::Schema::CD->might_have(liner_notes => 'DBICTest::Schema::LinerNotes',
19 undef, { proxy => [ qw/notes/ ] });
21 DBICTest::Schema::SelfRefAlias->belongs_to(
22 self_ref => 'DBICTest::Schema::SelfRef');
23 DBICTest::Schema::SelfRefAlias->belongs_to(
24 alias => 'DBICTest::Schema::SelfRef');
26 DBICTest::Schema::SelfRef->has_many(
27 aliases => 'DBICTest::Schema::SelfRefAlias' => 'self_ref');
29 DBICTest::Schema::Tag->belongs_to('cd', 'DBICTest::Schema::CD');
31 DBICTest::Schema::Track->belongs_to('cd', 'DBICTest::Schema::CD');
32 DBICTest::Schema::Track->belongs_to('disc', 'DBICTest::Schema::CD', 'cd');
34 DBICTest::Schema::TwoKeys->belongs_to('artist', 'DBICTest::Schema::Artist');
35 DBICTest::Schema::TwoKeys->belongs_to('cd', 'DBICTest::Schema::CD');
37 DBICTest::Schema::CD_to_Producer->belongs_to(
38 'cd', 'DBICTest::Schema::CD',
39 { 'foreign.cdid' => 'self.cd' }
41 DBICTest::Schema::CD_to_Producer->belongs_to(
42 'producer', 'DBICTest::Schema::Producer',
43 { 'foreign.producerid' => 'self.producer' }
45 DBICTest::Schema::Artist->has_many(
46 'artist_undirected_maps', 'DBICTest::Schema::ArtistUndirectedMap',
47 [{'foreign.id1' => 'self.artistid'}, {'foreign.id2' => 'self.artistid'}],
48 { cascade_copy => 0 } # this would *so* not make sense
50 DBICTest::Schema::ArtistUndirectedMap->belongs_to(
51 'artist1', 'DBICTest::Schema::Artist', 'id1');
52 DBICTest::Schema::ArtistUndirectedMap->belongs_to(
53 'artist2', 'DBICTest::Schema::Artist', 'id2');
54 DBICTest::Schema::ArtistUndirectedMap->has_many(
55 'mapped_artists', 'DBICTest::Schema::Artist',
56 [{'foreign.artistid' => 'self.id1'}, {'foreign.artistid' => 'self.id2'}]);
59 DBICTest::Schema::CD->many_to_many( 'producers', 'cd_to_producer', 'producer');
60 DBICTest::Schema::CD->many_to_many( 'producers_sorted', 'cd_to_producer', 'producer', { order_by => 'producer.name' });