Commit | Line | Data |
0567538f |
1 | package DBICTest::Schema::BasicRels; |
2 | |
3 | use base 'DBIx::Class::Core'; |
4 | |
5 | DBICTest::Schema::Artist->add_relationship( |
6 | cds => 'DBICTest::Schema::CD', |
7 | { 'foreign.artist' => 'self.artistid' }, |
8 | { order_by => 'year' } |
9 | ); |
10 | DBICTest::Schema::Artist->add_relationship( |
11 | twokeys => 'DBICTest::Schema::TwoKeys', |
12 | { 'foreign.artist' => 'self.artistid' } |
13 | ); |
14 | DBICTest::Schema::Artist->add_relationship( |
15 | onekeys => 'DBICTest::Schema::OneKey', |
16 | { 'foreign.artist' => 'self.artistid' } |
17 | ); |
18 | |
19 | DBICTest::Schema::CD->add_relationship( |
20 | artist => 'DBICTest::Schema::Artist', |
21 | { 'foreign.artistid' => 'self.artist' }, |
22 | ); |
23 | DBICTest::Schema::CD->add_relationship( |
24 | tracks => 'DBICTest::Schema::Track', |
25 | { 'foreign.cd' => 'self.cdid' } |
26 | ); |
27 | DBICTest::Schema::CD->add_relationship( |
28 | tags => 'DBICTest::Schema::Tag', |
29 | { 'foreign.cd' => 'self.cdid' } |
30 | ); |
31 | #DBICTest::Schema::CD->might_have(liner_notes => 'DBICTest::Schema::LinerNotes' => qw/notes/); |
32 | DBICTest::Schema::CD->add_relationship( |
33 | liner_notes => 'DBICTest::Schema::LinerNotes', |
34 | { 'foreign.liner_id' => 'self.cdid' }, |
35 | { join_type => 'LEFT' } |
36 | ); |
37 | |
38 | |
39 | DBICTest::Schema::SelfRefAlias->add_relationship( |
40 | self_ref => 'DBICTest::Schema::SelfRef', |
41 | { 'foreign.id' => 'self.self_ref' }, |
42 | { accessor => 'single' } |
43 | |
44 | ); |
45 | DBICTest::Schema::SelfRefAlias->add_relationship( |
46 | alias => 'DBICTest::Schema::SelfRef', |
47 | { 'foreign.id' => 'self.alias' }, |
48 | { accessor => 'single' } |
49 | ); |
50 | |
51 | DBICTest::Schema::SelfRef->add_relationship( |
52 | aliases => 'DBICTest::Schema::SelfRefAlias', |
53 | { 'foreign.self_ref' => 'self.id' }, |
54 | { accessor => 'multi' } |
55 | ); |
56 | |
57 | DBICTest::Schema::Tag->add_relationship( |
58 | cd => 'DBICTest::Schema::CD', |
59 | { 'foreign.cdid' => 'self.cd' } |
60 | ); |
61 | |
62 | DBICTest::Schema::Track->add_relationship( |
63 | cd => 'DBICTest::Schema::CD', |
64 | { 'foreign.cdid' => 'self.cd' } |
65 | ); |
66 | |
67 | DBICTest::Schema::TwoKeys->add_relationship( |
68 | artist => 'DBICTest::Schema::Artist', |
69 | { 'foreign.artistid' => 'self.artist' } |
70 | ); |
71 | DBICTest::Schema::TwoKeys->add_relationship( |
72 | cd => 'DBICTest::Schema::CD', |
73 | { 'foreign.cdid' => 'self.cd' } |
74 | ); |
75 | |
76 | 1; |