]> Dogcows Code - chaz/p5-DBIx-Class-ResultSet-RecursiveUpdate/commitdiff
moved relationship_info inside _update_relation instead of passing it around
authorAlexander Hartmaier <alexander.hartmaier@t-systems.at>
Mon, 4 Oct 2010 11:53:33 +0000 (13:53 +0200)
committerAlexander Hartmaier <alexander.hartmaier@t-systems.at>
Mon, 4 Oct 2010 11:53:33 +0000 (13:53 +0200)
lib/DBIx/Class/ResultSet/RecursiveUpdate.pm

index 04685e7a63fbad39516c80ed236291dd3bc58c21..b9bf433e887f84928d3d715bf35b5bfd94201805 100644 (file)
@@ -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;
This page took 0.021408 seconds and 4 git commands to generate.