Update to add myself to contributors and to hide Modules from the PAUSE Indexer.
[dbsrgits/DBIx-Class.git] / t / lib / DBICTest / Schema / HelperRels.pm
CommitLineData
7411204b 1package DBICTest::Schema::HelperRels;
0567538f 2
3use base 'DBIx::Class::Core';
4
07037f89 5DBICTest::Schema::Artist->has_many(cds => 'DBICTest::Schema::CD', undef,
6 { order_by => 'year' });
7DBICTest::Schema::Artist->has_many(twokeys => 'DBICTest::Schema::TwoKeys');
8DBICTest::Schema::Artist->has_many(onekeys => 'DBICTest::Schema::OneKey');
0567538f 9
07037f89 10DBICTest::Schema::CD->belongs_to('artist', 'DBICTest::Schema::Artist');
0567538f 11
07037f89 12DBICTest::Schema::CD->has_many(tracks => 'DBICTest::Schema::Track');
5a5bec6c 13DBICTest::Schema::CD->has_many(tags => 'DBICTest::Schema::Tag', undef,
14 { order_by => 'tag' });
7411204b 15DBICTest::Schema::CD->has_many(cd_to_producer => 'DBICTest::Schema::CD_to_Producer' => 'cd');
0567538f 16
503536d5 17DBICTest::Schema::CD->might_have(liner_notes => 'DBICTest::Schema::LinerNotes',
18 undef, { proxy => [ qw/notes/ ] });
0567538f 19
07037f89 20DBICTest::Schema::SelfRefAlias->belongs_to(
21 self_ref => 'DBICTest::Schema::SelfRef');
07037f89 22DBICTest::Schema::SelfRefAlias->belongs_to(
23 alias => 'DBICTest::Schema::SelfRef');
0567538f 24
07037f89 25DBICTest::Schema::SelfRef->has_many(
26 aliases => 'DBICTest::Schema::SelfRefAlias' => 'self_ref');
0567538f 27
07037f89 28DBICTest::Schema::Tag->belongs_to('cd', 'DBICTest::Schema::CD');
29
b8777a0d 30DBICTest::Schema::Track->belongs_to('cd', 'DBICTest::Schema::CD');
1e3bc087 31DBICTest::Schema::Track->belongs_to('disc', 'DBICTest::Schema::CD', 'cd');
07037f89 32
33DBICTest::Schema::TwoKeys->belongs_to('artist', 'DBICTest::Schema::Artist');
07037f89 34DBICTest::Schema::TwoKeys->belongs_to('cd', 'DBICTest::Schema::CD');
0567538f 35
5efe4c79 36DBICTest::Schema::CD_to_Producer->belongs_to(
37 'cd', 'DBICTest::Schema::CD',
38 { 'foreign.cdid' => 'self.cd' }
39);
40DBICTest::Schema::CD_to_Producer->belongs_to(
41 'producer', 'DBICTest::Schema::Producer',
42 { 'foreign.producerid' => 'self.producer' }
43);
44DBICTest::Schema::Artist->has_many(
45 'artist_undirected_maps', 'DBICTest::Schema::ArtistUndirectedMap',
333cce60 46 [{'foreign.id1' => 'self.artistid'}, {'foreign.id2' => 'self.artistid'}],
47 { cascade_copy => 0 } # this would *so* not make sense
5efe4c79 48);
49DBICTest::Schema::ArtistUndirectedMap->belongs_to(
50 'artist1', 'DBICTest::Schema::Artist', 'id1');
51DBICTest::Schema::ArtistUndirectedMap->belongs_to(
52 'artist2', 'DBICTest::Schema::Artist', 'id2');
53DBICTest::Schema::ArtistUndirectedMap->has_many(
54 'mapped_artists', 'DBICTest::Schema::Artist',
55 [{'foreign.artistid' => 'self.id1'}, {'foreign.artistid' => 'self.id2'}]);
7411204b 56
57# now the Helpers
58DBICTest::Schema::CD->many_to_many( 'producers', 'cd_to_producer', 'producer');
0f6ac8bb 59DBICTest::Schema::CD->many_to_many( 'producers_sorted', 'cd_to_producer', 'producer', { order_by => 'producer.name' });
7411204b 60
0567538f 611;