oddities with create fixed, bug in reflector
[catagits/Reaction.git] / t / lib / RTest / TestDB / Foo.pm
CommitLineData
7adfd53f 1package # hide from PAUSE
2 RTest::TestDB::Foo;
3
4use DBIx::Class 0.07;
5
6use base qw/DBIx::Class Reaction::Object/;
7use Reaction::Class;
8
9has 'id' => (isa => 'Int', is => 'ro', required => 1);
10has 'first_name' => (isa => 'NonEmptySimpleStr', is => 'rw', required => 1);
11has 'last_name' => (isa => 'NonEmptySimpleStr', is => 'rw', required => 1);
12has 'baz_list' => (
13 isa => 'ArrayRef', is => 'rw', required => 1,
14 reader => 'get_baz_list', writer => 'set_baz_list'
15);
16
17__PACKAGE__->load_components(qw/InflateColumn::DateTime Core/);
18
19__PACKAGE__->table('foo');
20
21__PACKAGE__->add_columns(
22 id => { data_type => 'integer', size => 16, is_auto_increment => 1 },
23 first_name => { data_type => 'varchar', size => 255 },
24 last_name => { data_type => 'varchar', size => 255 },
25);
26
27sub display_name {
28 my $self = shift;
29 return join(' ', $self->first_name, $self->last_name);
30}
31
32__PACKAGE__->set_primary_key('id');
33
34__PACKAGE__->has_many('links_to_baz_list' => 'RTest::TestDB::FooBaz', 'foo');
35__PACKAGE__->many_to_many('baz_list' => 'links_to_baz_list' => 'baz');
36
37{
38 no warnings 'redefine';
39 *get_baz_list = sub { [ shift->baz_list->all ] };
40}
41
a5200252 42
c689b58e 43__PACKAGE__->meta->make_immutable(inline_constructor => 0);
a5200252 44
7adfd53f 451;