replace all remaining uses of self_rowobj with self_resultobj in pod, test schemas
[dbsrgits/DBIx-Class.git] / t / lib / DBICTest / Schema / Artwork_to_Artist.pm
1 package # hide from PAUSE
2     DBICTest::Schema::Artwork_to_Artist;
3
4 use warnings;
5 use strict;
6
7 use base 'DBICTest::BaseResult';
8 use DBICTest::Util 'check_customcond_args';
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
25 __PACKAGE__->belongs_to('artist_test_m2m', 'DBICTest::Schema::Artist',
26   sub {
27     # This is for test purposes only. A regular user does not
28     # need to sanity check the passed-in arguments, this is what
29     # the tests are for :)
30     my $args = &check_customcond_args;
31
32     return (
33       { "$args->{foreign_alias}.artistid" => { -ident => "$args->{self_alias}.artist_id" },
34         "$args->{foreign_alias}.rank"     => { '<' => 10 },
35       },
36       $args->{self_resultobj} && {
37         "$args->{foreign_alias}.artistid" => $args->{self_resultobj}->artist_id,
38         "$args->{foreign_alias}.rank"   => { '<' => 10 },
39       }
40     );
41   }
42 );
43
44 __PACKAGE__->belongs_to('artist_test_m2m_noopt', 'DBICTest::Schema::Artist',
45   sub {
46     # This is for test purposes only. A regular user does not
47     # need to sanity check the passed-in arguments, this is what
48     # the tests are for :)
49     my $args = &check_customcond_args;
50
51     return (
52       { "$args->{foreign_alias}.artistid" => { -ident => "$args->{self_alias}.artist_id" },
53         "$args->{foreign_alias}.rank"     => { '<' => 10 },
54       }
55     );
56   }
57 );
58
59 1;