[Catalyst-commits] r8070 - in
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD: . Test
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Wed Jul 2 05:16:29 BST 2008
Author: karpet
Date: 2008-07-02 05:16:29 +0100 (Wed, 02 Jul 2008)
New Revision: 8070
Modified:
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/ModelAdapter.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Form.pm
Log:
tweek api to pass controller instance to model adapter
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm 2008-07-02 04:15:33 UTC (rev 8069)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm 2008-07-02 04:16:29 UTC (rev 8070)
@@ -406,7 +406,7 @@
my $c = shift or $self->throw_error("context required");
my $method = shift or $self->throw_error("method required");
if ( $self->model_adapter ) {
- return $self->model_adapter->$method( $c, @_ );
+ return $self->model_adapter->$method( $self, $c, @_ );
}
else {
return $c->model( $self->model_name )->$method(@_);
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/ModelAdapter.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/ModelAdapter.pm 2008-07-02 04:15:33 UTC (rev 8069)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/ModelAdapter.pm 2008-07-02 04:16:29 UTC (rev 8070)
@@ -8,7 +8,7 @@
use Class::C3;
use Carp;
-__PACKAGE__->mk_accessors(qw( model_name model_meta ));
+__PACKAGE__->mk_accessors(qw( model_name context ));
=head1 NAME
@@ -65,7 +65,7 @@
The following methods should be implemented in your subclass.
-=head2 new_object( I<context> )
+=head2 new_object( I<controller>, I<context> )
Should return a new instance from the Model you are adapting.
@@ -73,7 +73,7 @@
sub new_object { shift->throw_error("must implement new_object"); }
-=head2 fetch( I<context>, I<args> )
+=head2 fetch( I<controller>, I<context>, I<args> )
Should return an instance of the Model you are adapting, based
on I<args>.
@@ -82,7 +82,7 @@
sub fetch { shift->throw_error("must implement fetch") }
-=head2 search( I<context>, I<args> )
+=head2 search( I<controller>, I<context>, I<args> )
Should return an arrayref of instances of the Model you are adapting,
based on I<args>.
@@ -91,7 +91,7 @@
sub search { shift->throw_error("must implement search") }
-=head2 iterator( I<context>, I<args> )
+=head2 iterator( I<controller>, I<context>, I<args> )
Should return an iterator of instances of the Model you are adapting,
based on I<args>.
@@ -100,7 +100,7 @@
sub iterator { shift->throw_error("must implement iterator") }
-=head2 count( I<context>, I<args> )
+=head2 count( I<controller>, I<context>, I<args> )
Should return an integer representing the numbef of matching instances
of the Model you are adapting, based on I<args>.
@@ -109,7 +109,7 @@
sub count { shift->throw_error("must implement count") }
-=head2 make_query( I<context> )
+=head2 make_query( I<context>, I<controller> )
Should return appropriate values for passing to search(), iterator() and
count(). See CataystX::CRUD::Model for examples.
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Form.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Form.pm 2008-07-02 04:15:33 UTC (rev 8069)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Form.pm 2008-07-02 04:16:29 UTC (rev 8070)
@@ -58,6 +58,8 @@
return $self;
}
+*field_names = \&fields;
+
=head2 fields( [ I<arrayref> ] )
Get/set the arrayref of field names.
More information about the Catalyst-commits
mailing list