From 510f6c258c4f33c20a555db88cdb148e0f451e55 Mon Sep 17 00:00:00 2001 From: groditi Date: Tue, 1 Jul 2008 17:40:49 +0000 Subject: fixes to choosemany that will be reqired in latest Moose --- t/lib/RTest/TestDB/Baz.pm | 10 +++++++++- t/lib/RTest/TestDB/Foo.pm | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 't') 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); -- cgit v1.2.3-54-g00ecf