From 9d64cae4d7714299c377b030fc6656f7195e5ab0 Mon Sep 17 00:00:00 2001 From: Alexander Hartmaier Date: Mon, 4 Oct 2010 13:46:44 +0200 Subject: [PATCH] rename $related_result -> $related_resultset --- lib/DBIx/Class/ResultSet/RecursiveUpdate.pm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm index 95813ca..04685e7 100644 --- a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm +++ b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm @@ -185,7 +185,8 @@ sub _get_columns_by_accessor { sub _update_relation { my ( $self, $name, $updates, $object, $info, $if_not_submitted ) = @_; - my $related_result = + # get a related resultset without a condition + my $related_resultset = $self->related_resultset($name)->result_source->resultset; my $resolved; if ( $self->result_source->can('_resolve_condition') ) { @@ -208,15 +209,15 @@ sub _update_relation { # an arrayref is only valid for has_many rels if ( ref $updates eq 'ARRAY' ) { my @updated_ids; - for my $sub_updates ( @{ $updates } ) { + for my $sub_updates ( @{$updates} ) { my $sub_object = recursive_update( - resultset => $related_result, + resultset => $related_resultset, updates => $sub_updates, resolved => $resolved ); push @updated_ids, $sub_object->id; } - my @related_pks = $related_result->result_source->primary_columns; + my @related_pks = $related_resultset->result_source->primary_columns; if ( defined $if_not_submitted && $if_not_submitted eq 'delete' ) { # only handles related result classes with single primary keys @@ -248,21 +249,21 @@ sub _update_relation { && defined $object->$name ) { $sub_object = recursive_update( - resultset => $related_result, + resultset => $related_resultset, updates => $updates, object => $object->$name ); } else { $sub_object = recursive_update( - resultset => $related_result, + resultset => $related_resultset, updates => $updates, resolved => $resolved ); } } elsif ( !ref $updates ) { - $sub_object = $related_result->find($updates) + $sub_object = $related_resultset->find($updates) unless ( !$updates && ( exists $info->{attrs}{join_type} -- 2.45.2