1 package Reaction::InterfaceModel::Action::DBIC::Result::Update;
3 use Reaction::InterfaceModel::Action;
4 use Reaction::Types::DBIC 'Row';
7 class Update is 'Reaction::InterfaceModel::Action', which {
9 does 'Reaction::InterfaceModel::Action::DBIC::Role::CheckUniques';
11 has '+target_model' => (isa => Row);
13 implements BUILD => as {
15 my $tm = $self->target_model;
16 foreach my $attr ($self->parameter_attributes) {
17 my $writer = $attr->get_write_method;
18 my $name = $attr->name;
19 my $tm_attr = $tm->meta->find_attribute_by_name($name);
20 next unless ref $tm_attr;
21 my $tm_reader = $tm_attr->get_read_method;
22 $self->$writer($tm->$tm_reader) if defined($tm->$tm_reader);
26 implements do_apply => as {
28 my $args = $self->parameter_hashref;
29 my $model = $self->target_model;
30 foreach my $name (keys %$args) {
31 my $tm_attr = $model->meta->find_attribute_by_name($name);
32 next unless ref $tm_attr;
33 my $tm_writer = $tm_attr->get_write_method;
34 $model->$tm_writer($args->{$name});
46 Reaction::InterfaceModel::Action::DBIC::Result::Update
52 =head2 error_for_attribute
60 See L<Reaction::Class> for authors.
64 See L<Reaction::Class> for the license.