aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/InterfaceModel
diff options
context:
space:
mode:
authorwreis <wreis@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-10-31 23:04:38 +0000
committerwreis <wreis@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-10-31 23:04:38 +0000
commit41e7489416889eb993e36b7665e8c26b5ac62860 (patch)
treea8e303586991bec92f5b6071e856e844f6cb3f19 /lib/Reaction/InterfaceModel
parent7cbd4ca688b35afc705448bcf19af3b9683403e6 (diff)
parent9bcafb35533be7023bc77922da376cc6e7fc2735 (diff)
downloadreaction-41e7489416889eb993e36b7665e8c26b5ac62860.tar.gz
reaction-41e7489416889eb993e36b7665e8c26b5ac62860.zip
r28901@tabor (orig r932): edenc | 2008-10-30 19:28:16 -0300
declaring ->ctx as a weak ref to avoid memory leaks r28902@tabor (orig r933): edenc | 2008-10-30 19:29:18 -0300 adding logic to deal with unset option in a ChooseOne r28927@tabor (orig r934): edenc | 2008-10-31 11:15:39 -0300 readded lazy checks to enable choose one defaults based on lazy_build r28928@tabor (orig r935): edenc | 2008-10-31 12:35:19 -0300 reversed lazy checks as they cause optional fields to fail r28949@tabor (orig r939): groditi | 2008-10-31 19:04:14 -0300 r23076@martha (orig r916): groditi | 2008-10-11 16:42:31 -0400 make the behavior of sort_by_spec more predictable and a default order on empty spec r28950@tabor (orig r940): groditi | 2008-10-31 19:04:19 -0300 r23077@martha (orig r917): groditi | 2008-10-11 16:44:51 -0400 on second thought, make all empty specs return a lexical sort r28951@tabor (orig r941): groditi | 2008-10-31 19:04:34 -0300 r23078@martha (orig r918): groditi | 2008-10-11 17:00:05 -0400 change listview/grid so that members of a grid can have actions by default, it will just no-op if there is no prototypes present r28952@tabor (orig r942): groditi | 2008-10-31 19:04:45 -0300 r23079@martha (orig r919): groditi | 2008-10-11 17:03:58 -0400 formatting changes only. no actual functionality difference r28953@tabor (orig r943): groditi | 2008-10-31 19:04:56 -0300 r23080@martha (orig r920): groditi | 2008-10-11 17:15:47 -0400 completely new way of handling action prototypes for actions in CRUD that is much saner and less reliant on $ctx. also more flexible and configurable r28954@tabor (orig r944): groditi | 2008-10-31 19:05:01 -0300 r23081@martha (orig r921): groditi | 2008-10-11 19:35:34 -0400 some stub POD r28955@tabor (orig r945): groditi | 2008-10-31 19:05:07 -0300 r23082@martha (orig r922): groditi | 2008-10-11 19:45:47 -0400 some more doc patches r28956@tabor (orig r946): groditi | 2008-10-31 19:05:13 -0300 r23441@martha (orig r923): groditi | 2008-10-23 22:00:04 -0400 POD FTW r28957@tabor (orig r947): groditi | 2008-10-31 19:05:19 -0300 r23442@martha (orig r924): groditi | 2008-10-23 22:26:09 -0400 more POD r28958@tabor (orig r948): groditi | 2008-10-31 19:05:26 -0300 r23443@martha (orig r925): groditi | 2008-10-23 23:15:03 -0400 just a little more POD r28959@tabor (orig r949): groditi | 2008-10-31 19:05:35 -0300 r23463@martha (orig r926): groditi | 2008-10-24 19:50:38 -0400 more POD! r28960@tabor (orig r950): groditi | 2008-10-31 19:05:49 -0300 r23569@martha (orig r936): groditi | 2008-10-31 17:10:33 -0400 checking in more pod, some fixes for weird bugs, a manual for migration, an extra ComponentUI example and a new ResultSet base class for IM actions
Diffstat (limited to 'lib/Reaction/InterfaceModel')
-rw-r--r--lib/Reaction/InterfaceModel/Action/DBIC/Result.pm35
-rw-r--r--lib/Reaction/InterfaceModel/Action/DBIC/Result/Delete.pm31
-rw-r--r--lib/Reaction/InterfaceModel/Action/DBIC/Result/Update.pm37
-rw-r--r--lib/Reaction/InterfaceModel/Action/DBIC/ResultSet.pm48
-rw-r--r--lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/Create.pm24
-rw-r--r--lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/DeleteAll.pm33
6 files changed, 164 insertions, 44 deletions
diff --git a/lib/Reaction/InterfaceModel/Action/DBIC/Result.pm b/lib/Reaction/InterfaceModel/Action/DBIC/Result.pm
index 405209e..3b172c6 100644
--- a/lib/Reaction/InterfaceModel/Action/DBIC/Result.pm
+++ b/lib/Reaction/InterfaceModel/Action/DBIC/Result.pm
@@ -7,11 +7,40 @@ use Reaction::Class;
use namespace::clean -except => [ qw(meta) ];
extends 'Reaction::InterfaceModel::Action';
-
-
has '+target_model' => (isa => Row);
__PACKAGE__->meta->make_immutable;
-
1;
+
+__END__;
+
+=head1 NAME
+
+Reaction::InterfaceModel::Action::DBIC::Result
+
+=head1 DESCRIPTION
+
+Base class for actions that apply to DBIC row objects. Extends
+L<InterfaceModel::Action|Reaction::InterfaceModel::Action>
+
+=head1 ATTRIBUTES
+
+=head2 target_model
+
+Extends C<target_model> by assigning it a type constraint of
+L<Row|Reaction::Types::DBIC>.
+
+=head1 SEE ALSO
+
+L<Action::DBIC::ResultSet|Reaction::InterfaceModel::Action::DBIC::ResultSet>,
+
+=head1 AUTHORS
+
+See L<Reaction::Class> for authors.
+
+=head1 LICENSE
+
+See L<Reaction::Class> for the license.
+
+=cut
diff --git a/lib/Reaction/InterfaceModel/Action/DBIC/Result/Delete.pm b/lib/Reaction/InterfaceModel/Action/DBIC/Result/Delete.pm
index 3f4e818..7b6aaba 100644
--- a/lib/Reaction/InterfaceModel/Action/DBIC/Result/Delete.pm
+++ b/lib/Reaction/InterfaceModel/Action/DBIC/Result/Delete.pm
@@ -1,28 +1,41 @@
package Reaction::InterfaceModel::Action::DBIC::Result::Delete;
-use aliased 'Reaction::InterfaceModel::Action::DBIC::Result';
-use aliased 'Reaction::InterfaceModel::Action::Role::SimpleMethodCall';
-use Reaction::Types::DBIC 'Row';
use Reaction::Class;
-
use namespace::clean -except => [ qw(meta) ];
-extends Result;
-with SimpleMethodCall;
-sub _target_model_method { 'delete' };
+extends 'Reaction::InterfaceModel::Action::DBIC::Result';
+with 'Reaction::InterfaceModel::Action::Role::SimpleMethodCall';
-__PACKAGE__->meta->make_immutable;
+sub _target_model_method { 'delete' }
+__PACKAGE__->meta->make_immutable;
1;
+__END__;
+
=head1 NAME
Reaction::InterfaceModel::Action::DBIC::Result::Delete
=head1 DESCRIPTION
-=head2 target_model
+C<Delete> is a subclass of
+L<Action::DBIC::Result|Reaction::InterfaceModel::Action::DBIC::Result> that consumes
+L<Role::SimpleMethodCall|'Reaction::InterfaceModel::Action::Role::SimpleMethodCall>
+to call the C<target_model>'s C<delete> method
+
+=head1 METHODS
+
+=head2 _target_model_method
+
+Returns 'delete'
+
+=head1 SEE ALSO
+
+L<Create|Reaction::InterfaceModel::Action::DBIC::ResultSet::Create>,
+L<DeleteAll|Reaction::InterfaceModel::Action::DBIC::ResultSet::DeleteAll>,
+L<Update|Reaction::InterfaceModel::Action::DBIC::Result::Update>,
=head1 AUTHORS
diff --git a/lib/Reaction/InterfaceModel/Action/DBIC/Result/Update.pm b/lib/Reaction/InterfaceModel/Action/DBIC/Result/Update.pm
index 78e3146..b5068cc 100644
--- a/lib/Reaction/InterfaceModel/Action/DBIC/Result/Update.pm
+++ b/lib/Reaction/InterfaceModel/Action/DBIC/Result/Update.pm
@@ -1,13 +1,11 @@
package Reaction::InterfaceModel::Action::DBIC::Result::Update;
-use aliased 'Reaction::InterfaceModel::Action::DBIC::Result';
-use Reaction::Types::DBIC 'Row';
use Reaction::Class;
-
use namespace::clean -except => [ qw(meta) ];
-extends Result;
+extends 'Reaction::InterfaceModel::Action::DBIC::Result';
with 'Reaction::InterfaceModel::Action::DBIC::Role::CheckUniques';
+
sub BUILD {
my ($self) = @_;
my $tm = $self->target_model;
@@ -19,7 +17,8 @@ sub BUILD {
my $tm_reader = $tm_attr->get_read_method;
$self->$writer($tm->$tm_reader) if defined($tm->$tm_reader);
}
-};
+}
+
sub do_apply {
my $self = shift;
my $args = $self->parameter_hashref;
@@ -32,27 +31,43 @@ sub do_apply {
}
$model->update;
return $model;
-};
+}
__PACKAGE__->meta->make_immutable;
-
1;
+__END__;
+
=head1 NAME
Reaction::InterfaceModel::Action::DBIC::Result::Update
=head1 DESCRIPTION
-=head2 target_model
-
-=head2 error_for_attribute
+Update the target model and sync the Action's parameter attributes to
+the target model.
-=head2 sync_all
+C<Update> is a subclass of
+L<Action::DBIC::Result|Reaction::InterfaceModel::Action::DBIC::Result> that cponsumes
+L<Role::CheckUniques|'Reaction::InterfaceModel::Action::DBIC::Role::CheckUniques>
=head2 BUILD
+Sync the values from the target model's parameter attributes to the action's
+parameter attributes
+
+=head2 do_apply
+
+Sync the target model's parameter attributes to the values returned by
+C<parameter_hashref>, call C<update> and return the C<target_model>.
+
+=head1 SEE ALSO
+
+L<Create|Reaction::InterfaceModel::Action::DBIC::ResultSet::Create>,
+L<DeleteAll|Reaction::InterfaceModel::Action::DBIC::ResultSet::DeleteAll>,
+L<Delete|Reaction::InterfaceModel::Action::DBIC::Result::Delete>,
+
=head1 AUTHORS
See L<Reaction::Class> for authors.
diff --git a/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet.pm b/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet.pm
new file mode 100644
index 0000000..90bc429
--- /dev/null
+++ b/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet.pm
@@ -0,0 +1,48 @@
+package Reaction::InterfaceModel::Action::DBIC::ResultSet;
+
+use Reaction::InterfaceModel::Action;
+use Reaction::Types::DBIC 'ResultSet';
+use Reaction::Class;
+
+use namespace::clean -except => [ qw(meta) ];
+extends 'Reaction::InterfaceModel::Action';
+
+has '+target_model' => (isa => ResultSet);
+
+__PACKAGE__->meta->make_immutable;
+
+1;
+
+__END__;
+
+
+=head1 NAME
+
+Reaction::InterfaceModel::Action::DBIC::ResultSet
+
+=head1 DESCRIPTION
+
+Base class for actions that apply to DBIC resultset objects. Extends
+L<InterfaceModel::Action|Reaction::InterfaceModel::Action>
+
+=head1 ATTRIBUTES
+
+=head2 target_model
+
+Extends C<target_model> by assigning it a type constraint of
+L<ResultSet|Reaction::Types::DBIC>.
+
+=head1 SEE ALSO
+
+L<Action::DBIC::Result|Reaction::InterfaceModel::Action::DBIC::Result>,
+
+=head1 AUTHORS
+
+See L<Reaction::Class> for authors.
+
+=head1 LICENSE
+
+See L<Reaction::Class> for the license.
+
+=cut
+
diff --git a/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/Create.pm b/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/Create.pm
index d81ff5a..c6e6dd1 100644
--- a/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/Create.pm
+++ b/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/Create.pm
@@ -6,11 +6,10 @@ use Reaction::InterfaceModel::Action;
use Reaction::InterfaceModel::Action::DBIC::Role::CheckUniques;
use namespace::clean -except => [ qw(meta) ];
-extends 'Reaction::InterfaceModel::Action';
+extends 'Reaction::InterfaceModel::Action::DBIC::ResultSet';
with 'Reaction::InterfaceModel::Action::DBIC::Role::CheckUniques';
-has '+target_model' => (isa => ResultSet);
sub do_apply {
my $self = shift;
my $args = $self->parameter_hashref;
@@ -40,20 +39,33 @@ sub do_apply {
__PACKAGE__->meta->make_immutable;
-
1;
+__END__;
+
=head1 NAME
Reaction::InterfaceModel::Action::DBIC::ResultSet::Create
=head1 DESCRIPTION
-=head2 target_model
+Create a new object.
+
+C<Update> is a subclass of
+L<Action::DBIC::ResultSet|Reaction::InterfaceModel::Action::DBIC::ResultSet>
+that cponsumes L<Role::CheckUniques|'Reaction::InterfaceModel::Action::DBIC::Role::CheckUniques>
+
+=head2 do_apply
+
+Create a C<new_result> for the C<target_model>, sync it to the action's
+C<parameter_attributes> and C<insert> it into the database. Returns the newly
+inserted object
-=head2 error_for_attribute
+=head1 SEE ALSO
-=head2 sync_all
+L<DeleteAll|Reaction::InterfaceModel::Action::DBIC::ResultSet::DeleteAll>,
+L<Update|Reaction::InterfaceModel::Action::DBIC::Result::Update>,
+L<Delete|Reaction::InterfaceModel::Action::DBIC::Result::Delete>,
=head1 AUTHORS
diff --git a/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/DeleteAll.pm b/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/DeleteAll.pm
index b30990b..1ec946a 100644
--- a/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/DeleteAll.pm
+++ b/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/DeleteAll.pm
@@ -5,23 +5,16 @@ use Reaction::Class;
use Reaction::InterfaceModel::Action;
use namespace::clean -except => [ qw(meta) ];
-extends 'Reaction::InterfaceModel::Action';
+extends 'Reaction::InterfaceModel::Action::DBIC::ResultSet';
+with 'Reaction::InterfaceModel::Action::Role::SimpleMethodCall';
-
-
-has '+target_model' => (isa => ResultSet);
-
-sub can_apply { 1 }
-sub do_apply {
- my $self = shift;
- return $self->target_model->delete_all;
-};
+sub _target_model_method { 'delete_all' }
__PACKAGE__->meta->make_immutable;
-
1;
+__END__;
=head1 NAME
@@ -29,13 +22,23 @@ Reaction::InterfaceModel::Action::DBIC::ResultSet::DeleteAll
=head1 DESCRIPTION
-Deletes every item in the target_model ResultSet
+C<DeleteAll> is a subclass of
+L<Action::DBIC::ResultSet|Reaction::InterfaceModel::Action::DBIC::ResultSet> using
+L<Role::SimpleMethodCall|'Reaction::InterfaceModel::Action::Role::SimpleMethodCall>
+to call the C<target_model>'s C<delete_all> method, deleting every item in the
+resultset.
+
+=head1 METHODS
+
+=head2 _target_model_method
-=head2 target_model
+Returns 'delete_all'
-=head2 error_for_attribute
+=head1 SEE ALSO
-=head2 sync_all
+L<Create|Reaction::InterfaceModel::Action::DBIC::ResultSet::Create>,
+L<Update|Reaction::InterfaceModel::Action::DBIC::Result::Update>,
+L<Delete|Reaction::InterfaceModel::Action::DBIC::Result::Delete>,
=head1 AUTHORS