From: Alexander Hartmaier Date: Mon, 4 Oct 2010 11:53:33 +0000 (+0200) Subject: moved relationship_info inside _update_relation instead of passing it around X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=5a9d5be123f2111da8344d102dcd143a222be2dd;p=chaz%2Fp5-DBIx-Class-ResultSet-RecursiveUpdate moved relationship_info inside _update_relation instead of passing it around --- diff --git a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm index 04685e7..b9bf433 100644 --- a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm +++ b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm @@ -113,8 +113,7 @@ sub recursive_update { $object->$name( $updates->{$name} ) if $object->can($name); } for my $name ( keys %pre_updates ) { - my $info = $object->result_source->relationship_info($name); - _update_relation( $self, $name, $updates->{$name}, $object, $info, + _update_relation( $self, $name, $updates->{$name}, $object, $if_not_submitted ); } @@ -161,8 +160,7 @@ sub recursive_update { } } for my $name ( keys %post_updates ) { - my $info = $object->result_source->relationship_info($name); - _update_relation( $self, $name, $updates->{$name}, $object, $info, + _update_relation( $self, $name, $updates->{$name}, $object, $if_not_submitted ); } return $object; @@ -181,10 +179,12 @@ sub _get_columns_by_accessor { return %columns; } -# Arguments: $name, $updates, $object, $info, $if_not_submitted +# Arguments: $name, $updates, $object, $if_not_submitted sub _update_relation { - my ( $self, $name, $updates, $object, $info, $if_not_submitted ) = @_; + my ( $self, $name, $updates, $object, $if_not_submitted ) = @_; + my $info = $object->result_source->relationship_info($name); + # get a related resultset without a condition my $related_resultset = $self->related_resultset($name)->result_source->resultset;