1 package DBICTest::Schema::BasicRels;
3 use base 'DBIx::Class::Core';
5 DBICTest::Schema::Artist->add_relationship(
6 cds => 'DBICTest::Schema::CD',
7 { 'foreign.artist' => 'self.artistid' },
10 DBICTest::Schema::Artist->add_relationship(
11 twokeys => 'DBICTest::Schema::TwoKeys',
12 { 'foreign.artist' => 'self.artistid' }
14 DBICTest::Schema::Artist->add_relationship(
15 onekeys => 'DBICTest::Schema::OneKey',
16 { 'foreign.artist' => 'self.artistid' }
19 DBICTest::Schema::CD->has_one('artist', 'DBICTest::Schema::Artist');
20 #DBICTest::Schema::CD->add_relationship(
21 # artist => 'DBICTest::Schema::Artist',
22 # { 'foreign.artistid' => 'self.artist' },
24 DBICTest::Schema::CD->add_relationship(
25 tracks => 'DBICTest::Schema::Track',
26 { 'foreign.cd' => 'self.cdid' }
28 DBICTest::Schema::CD->add_relationship(
29 tags => 'DBICTest::Schema::Tag',
30 { 'foreign.cd' => 'self.cdid' }
32 #DBICTest::Schema::CD->might_have(liner_notes => 'DBICTest::Schema::LinerNotes' => qw/notes/);
33 DBICTest::Schema::CD->add_relationship(
34 liner_notes => 'DBICTest::Schema::LinerNotes',
35 { 'foreign.liner_id' => 'self.cdid' },
36 { join_type => 'LEFT' }
39 DBICTest::Schema::SelfRefAlias->add_relationship(
40 self_ref => 'DBICTest::Schema::SelfRef',
41 { 'foreign.id' => 'self.self_ref' },
42 { accessor => 'single' }
45 DBICTest::Schema::SelfRefAlias->add_relationship(
46 alias => 'DBICTest::Schema::SelfRef',
47 { 'foreign.id' => 'self.alias' },
48 { accessor => 'single' }
51 DBICTest::Schema::SelfRef->add_relationship(
52 aliases => 'DBICTest::Schema::SelfRefAlias',
53 { 'foreign.self_ref' => 'self.id' },
54 { accessor => 'multi' }
57 DBICTest::Schema::Tag->has_one('cd', 'DBICTest::Schema::CD');
58 #DBICTest::Schema::Tag->add_relationship(
59 # cd => 'DBICTest::Schema::CD',
60 # { 'foreign.cdid' => 'self.cd' }
63 DBICTest::Schema::Track->has_one('cd', 'DBICTest::Schema::CD');
64 #DBICTest::Schema::Track->add_relationship(
65 # cd => 'DBICTest::Schema::CD',
66 # { 'foreign.cdid' => 'self.cd' }
69 DBICTest::Schema::TwoKeys->has_one('artist', 'DBICTest::Schema::Artist');
70 # DBICTest::Schema::TwoKeys->add_relationship(
71 # artist => 'DBICTest::Schema::Artist',
72 # { 'foreign.artistid' => 'self.artist' }
74 DBICTest::Schema::TwoKeys->has_one('cd', 'DBICTest::Schema::CD');
75 #DBICTest::Schema::TwoKeys->add_relationship(
76 # cd => 'DBICTest::Schema::CD',
77 # { 'foreign.cdid' => 'self.cd' }