diff options
author | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-07-01 17:40:49 +0000 |
---|---|---|
committer | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-07-01 17:40:49 +0000 |
commit | 510f6c258c4f33c20a555db88cdb148e0f451e55 (patch) | |
tree | c9619db0f5c7a5d97545fd0449affdebffe778f6 /t | |
parent | b134d5b65b4e26215f871b3c94ad8397af3d00a3 (diff) | |
download | reaction-510f6c258c4f33c20a555db88cdb148e0f451e55.tar.gz reaction-510f6c258c4f33c20a555db88cdb148e0f451e55.zip |
fixes to choosemany that will be reqired in latest Moose
Diffstat (limited to 't')
-rw-r--r-- | t/lib/RTest/TestDB/Baz.pm | 10 | ||||
-rw-r--r-- | t/lib/RTest/TestDB/Foo.pm | 8 |
2 files changed, 16 insertions, 2 deletions
diff --git a/t/lib/RTest/TestDB/Baz.pm b/t/lib/RTest/TestDB/Baz.pm index 3ab411d..ad4c61e 100644 --- a/t/lib/RTest/TestDB/Baz.pm +++ b/t/lib/RTest/TestDB/Baz.pm @@ -10,7 +10,15 @@ use Reaction::Types::Core qw/NonEmptySimpleStr/; has 'id' => (isa => Int, is => 'ro', required => 1); has 'name' => (isa => NonEmptySimpleStr, is => 'rw', required => 1); -has 'foo_list' => (isa => ArrayRef, is => 'ro', required => 1); +has 'foo_list' => ( + isa => ArrayRef, + is => 'rw', + required => 1, + writer => 'set_foo_list', + reader => 'get_foo_list', + ); + +around get_foo_list => sub { [ $_[1]->foo_list->all ] }; use namespace::clean -except => [ 'meta' ]; diff --git a/t/lib/RTest/TestDB/Foo.pm b/t/lib/RTest/TestDB/Foo.pm index 7d8ab61..a7e669c 100644 --- a/t/lib/RTest/TestDB/Foo.pm +++ b/t/lib/RTest/TestDB/Foo.pm @@ -11,6 +11,7 @@ use Reaction::Types::Core qw/NonEmptySimpleStr/; has 'id' => (isa => Int, is => 'ro', required => 1); has 'first_name' => (isa => NonEmptySimpleStr, is => 'rw', required => 1); has 'last_name' => (isa => NonEmptySimpleStr, is => 'rw', required => 1); +has 'bars' => (isa => ArrayRef ); has 'bazes' => ( isa => ArrayRef, @@ -32,6 +33,11 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); +__PACKAGE__->has_many( + 'bars' => 'RTest::TestDB::Bar', + { 'foreign.foo_id' => 'self.id' } + ); + __PACKAGE__->has_many('foo_baz' => 'RTest::TestDB::FooBaz', 'foo'); __PACKAGE__->many_to_many('bazes' => 'foo_baz' => 'baz'); @@ -40,7 +46,7 @@ sub display_name { return join(' ', $self->first_name, $self->last_name); } -sub get_bazes { [ shift->bazes_rs->all ] }; +around get_bazes => sub { [ $_[1]->bazes_rs->all ] }; __PACKAGE__->meta->make_immutable(inline_constructor => 0); |