Some tweaks to Componentised, many_to_many helper from abraxxa
[dbsrgits/DBIx-Class-Historic.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');
13DBICTest::Schema::CD->has_many(tags => 'DBICTest::Schema::Tag');
7411204b 14DBICTest::Schema::CD->has_many(cd_to_producer => 'DBICTest::Schema::CD_to_Producer' => 'cd');
0567538f 15
503536d5 16DBICTest::Schema::CD->might_have(liner_notes => 'DBICTest::Schema::LinerNotes',
17 undef, { proxy => [ qw/notes/ ] });
0567538f 18
07037f89 19DBICTest::Schema::SelfRefAlias->belongs_to(
20 self_ref => 'DBICTest::Schema::SelfRef');
07037f89 21DBICTest::Schema::SelfRefAlias->belongs_to(
22 alias => 'DBICTest::Schema::SelfRef');
0567538f 23
07037f89 24DBICTest::Schema::SelfRef->has_many(
25 aliases => 'DBICTest::Schema::SelfRefAlias' => 'self_ref');
0567538f 26
07037f89 27DBICTest::Schema::Tag->belongs_to('cd', 'DBICTest::Schema::CD');
28
b8777a0d 29DBICTest::Schema::Track->belongs_to('cd', 'DBICTest::Schema::CD');
1e3bc087 30DBICTest::Schema::Track->belongs_to('disc', 'DBICTest::Schema::CD', 'cd');
07037f89 31
32DBICTest::Schema::TwoKeys->belongs_to('artist', 'DBICTest::Schema::Artist');
07037f89 33DBICTest::Schema::TwoKeys->belongs_to('cd', 'DBICTest::Schema::CD');
0567538f 34
7411204b 35DBICTest::Schema::CD_to_Producer->belongs_to('cd', 'DBICTest::Schema::CD', { 'foreign.cdid' => 'self.cd' });
36DBICTest::Schema::CD_to_Producer->belongs_to('producer', 'DBICTest::Schema::Producer', { 'foreign.producerid' => 'self.producer' });
37
38# now the Helpers
39DBICTest::Schema::CD->many_to_many( 'producers', 'cd_to_producer', 'producer');
40
0567538f 411;