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