Commit | Line | Data |
d5633096 |
1 | package # hide from PAUSE |
2 | DBICTest::Schema::Artwork_to_Artist; |
3 | |
660cf1be |
4 | use base qw/DBICTest::BaseResult/; |
d5633096 |
5 | |
6 | __PACKAGE__->table('artwork_to_artist'); |
7 | __PACKAGE__->add_columns( |
8 | 'artwork_cd_id' => { |
9 | data_type => 'integer', |
10 | is_foreign_key => 1, |
11 | }, |
12 | 'artist_id' => { |
13 | data_type => 'integer', |
14 | is_foreign_key => 1, |
15 | }, |
16 | ); |
17 | __PACKAGE__->set_primary_key(qw/artwork_cd_id artist_id/); |
18 | __PACKAGE__->belongs_to('artwork', 'DBICTest::Schema::Artwork', 'artwork_cd_id'); |
19 | __PACKAGE__->belongs_to('artist', 'DBICTest::Schema::Artist', 'artist_id'); |
20 | |
e98e6478 |
21 | __PACKAGE__->belongs_to('artist_test_m2m', 'DBICTest::Schema::Artist', |
22 | sub { |
23 | my $args = shift; |
24 | return ( |
25 | { "$args->{foreign_alias}.artistid" => { -ident => "$args->{self_alias}.artist_id" }, |
26 | "$args->{foreign_alias}.rank" => { '<' => 10 }, |
27 | }, |
28 | $args->{self_rowobj} && { |
29 | "$args->{foreign_alias}.artistid" => $args->{self_rowobj}->artist_id, |
30 | "$args->{foreign_alias}.rank" => { '<' => 10 }, |
31 | } |
32 | ); |
33 | }); |
34 | |
35 | __PACKAGE__->belongs_to('artist_test_m2m_noopt', 'DBICTest::Schema::Artist', |
36 | sub { |
37 | my $args = shift; |
38 | return ( |
39 | { "$args->{foreign_alias}.artistid" => { -ident => "$args->{self_alias}.artist_id" }, |
40 | "$args->{foreign_alias}.rank" => { '<' => 10 }, |
41 | } |
42 | ); |
43 | }); |
44 | |
d5633096 |
45 | 1; |