From: John Napiorkowski Date: Fri, 2 Apr 2010 16:35:01 +0000 (-0400) Subject: skip trying to create a might_have relationship if there is no data to insert X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-DBIx-Class-ResultSet-RecursiveUpdate;a=commitdiff_plain;h=75f3ba678630b75516689f3229db48f99f876604 skip trying to create a might_have relationship if there is no data to insert --- diff --git a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm index 1af66cc..eeec84c 100644 --- a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm +++ b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm @@ -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')); } } diff --git a/t/var/dvdzbr.db b/t/var/dvdzbr.db index cf2b20f..2cb45dc 100644 Binary files a/t/var/dvdzbr.db and b/t/var/dvdzbr.db differ