diff options
author | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-10-24 23:50:38 +0000 |
---|---|---|
committer | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-10-24 23:50:38 +0000 |
commit | 1c601a7646d5da9d4ca4c21a2734455ba184de1f (patch) | |
tree | 6b3667d5f6774347402e93dcb82989f86dab33da /lib/Reaction/InterfaceModel | |
parent | 7460b54490d1906c19559e37befa13fee7919227 (diff) | |
download | reaction-1c601a7646d5da9d4ca4c21a2734455ba184de1f.tar.gz reaction-1c601a7646d5da9d4ca4c21a2734455ba184de1f.zip |
more POD!
Diffstat (limited to 'lib/Reaction/InterfaceModel')
4 files changed, 82 insertions, 36 deletions
diff --git a/lib/Reaction/InterfaceModel/Action/DBIC/Result/Delete.pm b/lib/Reaction/InterfaceModel/Action/DBIC/Result/Delete.pm index 3f4e818..dddf6b4 100644 --- a/lib/Reaction/InterfaceModel/Action/DBIC/Result/Delete.pm +++ b/lib/Reaction/InterfaceModel/Action/DBIC/Result/Delete.pm @@ -1,28 +1,42 @@ 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; +extends 'Reaction::InterfaceModel::Action::DBIC::Result'; +with 'Reaction::InterfaceModel::Action::Role::SimpleMethodCall'; -with SimpleMethodCall; -sub _target_model_method { 'delete' }; +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..03ac9c1 100644 --- a/lib/Reaction/InterfaceModel/Action/DBIC/Result/Update.pm +++ b/lib/Reaction/InterfaceModel/Action/DBIC/Result/Update.pm @@ -1,13 +1,12 @@ 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; - +extend 'Reaction::InterfaceModel::Action::DBIC::Result'; with 'Reaction::InterfaceModel::Action::DBIC::Role::CheckUniques'; + sub BUILD { my ($self) = @_; my $tm = $self->target_model; @@ -19,7 +18,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 +32,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/Create.pm b/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/Create.pm index d81ff5a..6076570 100644 --- a/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/Create.pm +++ b/lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/Create.pm @@ -40,20 +40,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 |