Add strict/warnings test, adjust all offenders (wow, that was a lot)
[dbsrgits/DBIx-Class.git] / t / lib / DBICTest / Schema / Artwork_to_Artist.pm
CommitLineData
d5633096 1package # hide from PAUSE
2 DBICTest::Schema::Artwork_to_Artist;
4a233f30 3
4use warnings;
5use strict;
d5633096 6
660cf1be 7use base qw/DBICTest::BaseResult/;
6fbef4a4 8use Carp qw/confess/;
d5633096 9
10__PACKAGE__->table('artwork_to_artist');
11__PACKAGE__->add_columns(
12 'artwork_cd_id' => {
13 data_type => 'integer',
14 is_foreign_key => 1,
15 },
16 'artist_id' => {
17 data_type => 'integer',
18 is_foreign_key => 1,
19 },
20);
21__PACKAGE__->set_primary_key(qw/artwork_cd_id artist_id/);
22__PACKAGE__->belongs_to('artwork', 'DBICTest::Schema::Artwork', 'artwork_cd_id');
23__PACKAGE__->belongs_to('artist', 'DBICTest::Schema::Artist', 'artist_id');
24
e98e6478 25__PACKAGE__->belongs_to('artist_test_m2m', 'DBICTest::Schema::Artist',
6fbef4a4 26 sub {
27 my $args = shift;
28
29 # This is for test purposes only. A regular user does not
30 # need to sanity check the passed-in arguments, this is what
31 # the tests are for :)
32 my @missing_args = grep { ! defined $args->{$_} }
33 qw/self_alias foreign_alias self_resultsource foreign_relname/;
34 confess "Required arguments not supplied to custom rel coderef: @missing_args\n"
35 if @missing_args;
36
37 return (
38 { "$args->{foreign_alias}.artistid" => { -ident => "$args->{self_alias}.artist_id" },
39 "$args->{foreign_alias}.rank" => { '<' => 10 },
40 },
41 $args->{self_rowobj} && {
42 "$args->{foreign_alias}.artistid" => $args->{self_rowobj}->artist_id,
43 "$args->{foreign_alias}.rank" => { '<' => 10 },
44 }
45 );
46 }
47);
e98e6478 48
49__PACKAGE__->belongs_to('artist_test_m2m_noopt', 'DBICTest::Schema::Artist',
6fbef4a4 50 sub {
51 my $args = shift;
52
53 # This is for test purposes only. A regular user does not
54 # need to sanity check the passed-in arguments, this is what
55 # the tests are for :)
56 my @missing_args = grep { ! defined $args->{$_} }
57 qw/self_alias foreign_alias self_resultsource foreign_relname/;
58 confess "Required arguments not supplied to custom rel coderef: @missing_args\n"
59 if @missing_args;
60
61 return (
62 { "$args->{foreign_alias}.artistid" => { -ident => "$args->{self_alias}.artist_id" },
63 "$args->{foreign_alias}.rank" => { '<' => 10 },
64 }
65 );
66 }
67);
e98e6478 68
d5633096 691;