]> Dogcows Code - chaz/p5-DBIx-Class-ResultSet-RecursiveUpdate/commitdiff
skip trying to create a might_have relationship if there is no data to insert
authorJohn Napiorkowski <johnn@John-Napiorkowski-MacBook-Pro.local>
Fri, 2 Apr 2010 16:35:01 +0000 (12:35 -0400)
committerJohn Napiorkowski <johnn@John-Napiorkowski-MacBook-Pro.local>
Fri, 2 Apr 2010 16:35:01 +0000 (12:35 -0400)
lib/DBIx/Class/ResultSet/RecursiveUpdate.pm
t/var/dvdzbr.db

index 1af66cca62b80357ee7abdc0db53cf7ccc0c759d..eeec84cdd240e2007b07101c2d3cd784f184ce62 100644 (file)
@@ -208,15 +208,17 @@ sub _update_relation {
                     object =>  $object->$name 
                 );
             }
-            else{ 
+            else{
                 $sub_object =
                 recursive_update( resultset => $related_result, updates => $sub_updates, resolved => $resolved );
             }
         }
         elsif( ! ref $sub_updates ){
-            $sub_object = $related_result->find( $sub_updates );
+            $sub_object = $related_result->find( $sub_updates ) 
+             unless (!$sub_updates && ($info->{attrs}{join_type} eq 'LEFT'));
         }
-        $object->set_from_related( $name, $sub_object );
+        $object->set_from_related( $name, $sub_object )
+          unless (!$sub_object && !$sub_updates && ($info->{attrs}{join_type} eq 'LEFT'));
     }
 }
 
index cf2b20f9fa13dc1f5465d4350678d34e8e6fb566..2cb45dc9e6993e1b0ab34ed44aead710670acf55 100644 (file)
Binary files a/t/var/dvdzbr.db and b/t/var/dvdzbr.db differ
This page took 0.025638 seconds and 4 git commands to generate.