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