Update to hide modules from the PAUSE Indexer.
[dbsrgits/DBIx-Class.git] / t / lib / DBICTest / Schema / BasicRels.pm
CommitLineData
c6d74d3e 1package # hide from PAUSE
2 DBICTest::Schema::BasicRels;
0567538f 3
4use base 'DBIx::Class::Core';
5
6DBICTest::Schema::Artist->add_relationship(
7 cds => 'DBICTest::Schema::CD',
8 { 'foreign.artist' => 'self.artistid' },
64acc2bc 9 { order_by => 'year', join_type => 'LEFT', cascade_delete => 1, cascade_copy => 1, accessor => 'multi' }
0567538f 10);
11DBICTest::Schema::Artist->add_relationship(
12 twokeys => 'DBICTest::Schema::TwoKeys',
333cce60 13 { 'foreign.artist' => 'self.artistid' },
14 { cascade_copy => 1 }
0567538f 15);
16DBICTest::Schema::Artist->add_relationship(
17 onekeys => 'DBICTest::Schema::OneKey',
18 { 'foreign.artist' => 'self.artistid' }
19);
5efe4c79 20DBICTest::Schema::Artist->add_relationship(
21 artist_undirected_maps => 'DBICTest::Schema::ArtistUndirectedMap',
22 [{'foreign.id1' => 'self.artistid'}, {'foreign.id2' => 'self.artistid'}],
23 { accessor => 'multi' }
24);
25DBICTest::Schema::ArtistUndirectedMap->add_relationship(
26 'mapped_artists', 'DBICTest::Schema::Artist',
27 [{'foreign.artistid' => 'self.id1'}, {'foreign.artistid' => 'self.id2'}]
28);
0567538f 29DBICTest::Schema::CD->add_relationship(
30 artist => 'DBICTest::Schema::Artist',
31 { 'foreign.artistid' => 'self.artist' },
8452e496 32 { accessor => 'filter' },
0567538f 33);
34DBICTest::Schema::CD->add_relationship(
35 tracks => 'DBICTest::Schema::Track',
54540863 36 { 'foreign.cd' => 'self.cdid' },
37 { join_type => 'LEFT', cascade_delete => 1 }
0567538f 38);
39DBICTest::Schema::CD->add_relationship(
40 tags => 'DBICTest::Schema::Tag',
54540863 41 { 'foreign.cd' => 'self.cdid' },
f9cc31dd 42 { join_type => 'LEFT', cascade_delete => 1, cascade_copy => 1, accessor => 'multi' }
0567538f 43);
44#DBICTest::Schema::CD->might_have(liner_notes => 'DBICTest::Schema::LinerNotes' => qw/notes/);
45DBICTest::Schema::CD->add_relationship(
46 liner_notes => 'DBICTest::Schema::LinerNotes',
47 { 'foreign.liner_id' => 'self.cdid' },
8452e496 48 { join_type => 'LEFT', accessor => 'single' }
0567538f 49);
7411204b 50DBICTest::Schema::CD->add_relationship(
51 cd_to_producer => 'DBICTest::Schema::CD_to_Producer',
52 { 'foreign.cd' => 'self.cdid' },
53 { join_type => 'LEFT', cascade_delete => 1 }
54);
0567538f 55
56DBICTest::Schema::SelfRefAlias->add_relationship(
57 self_ref => 'DBICTest::Schema::SelfRef',
58 { 'foreign.id' => 'self.self_ref' },
59 { accessor => 'single' }
60
61);
62DBICTest::Schema::SelfRefAlias->add_relationship(
63 alias => 'DBICTest::Schema::SelfRef',
64 { 'foreign.id' => 'self.alias' },
65 { accessor => 'single' }
66);
67
68DBICTest::Schema::SelfRef->add_relationship(
69 aliases => 'DBICTest::Schema::SelfRefAlias',
70 { 'foreign.self_ref' => 'self.id' },
71 { accessor => 'multi' }
72);
73
74DBICTest::Schema::Tag->add_relationship(
75 cd => 'DBICTest::Schema::CD',
b3e8ac9b 76 { 'foreign.cdid' => 'self.cd' },
77 { accessor => 'single' }
0567538f 78);
79
80DBICTest::Schema::Track->add_relationship(
81 cd => 'DBICTest::Schema::CD',
35c2ee73 82 { 'foreign.cdid' => 'self.cd' }
0567538f 83);
84
85DBICTest::Schema::TwoKeys->add_relationship(
86 artist => 'DBICTest::Schema::Artist',
87 { 'foreign.artistid' => 'self.artist' }
88);
89DBICTest::Schema::TwoKeys->add_relationship(
90 cd => 'DBICTest::Schema::CD',
91 { 'foreign.cdid' => 'self.cd' }
92);
93
7411204b 94DBICTest::Schema::CD_to_Producer->add_relationship(
95 cd => 'DBICTest::Schema::CD',
96 { 'foreign.cdid' => 'self.cd' }
97);
98DBICTest::Schema::CD_to_Producer->add_relationship(
99 producer => 'DBICTest::Schema::Producer',
100 { 'foreign.producerid' => 'self.producer' }
101);
102
103# now the Helpers
104DBICTest::Schema::CD->many_to_many( 'producers', 'cd_to_producer', 'producer');
0f6ac8bb 105DBICTest::Schema::CD->many_to_many( 'producers_sorted', 'cd_to_producer', 'producer', { order_by => 'producer.name' });
7411204b 106
0567538f 1071;