testing for when resources are nested
[dbsrgits/DBIx-Class-Fixtures.git] / t / lib / DBICTest / Schema / Artist.pm
1 package # hide from PAUSE 
2     DBICTest::Schema::Artist;
3
4 use base 'DBIx::Class::Core';
5
6 __PACKAGE__->table('artist');
7 __PACKAGE__->add_columns(
8   'artistid' => {
9     data_type => 'integer',
10     is_auto_increment => 1,
11   },
12   'name' => {
13     data_type => 'varchar',
14     size      => 100,
15     is_nullable => 1,
16   },
17 );
18 __PACKAGE__->set_primary_key('artistid');
19
20 __PACKAGE__->has_many(
21     cds => 'DBICTest::Schema::CD', undef,
22     { order_by => 'year' },
23 );
24
25 __PACKAGE__->might_have(
26     washed_up => 'DBICTest::Schema::Artist::WashedUp',
27     {'foreign.fk_artistid' => 'self.artistid'},
28 );
29
30 sub new {
31         my ( $class, $args ) = @_;
32
33         $args->{name} = "Test Name" unless $args->{name};
34
35         return $class->next::method( $args );
36 }
37
38 1;