From 75f3ba678630b75516689f3229db48f99f876604 Mon Sep 17 00:00:00 2001 From: John Napiorkowski Date: Fri, 2 Apr 2010 12:35:01 -0400 Subject: [PATCH] skip trying to create a might_have relationship if there is no data to insert --- lib/DBIx/Class/ResultSet/RecursiveUpdate.pm | 8 +++++--- t/var/dvdzbr.db | Bin 38912 -> 36864 bytes 2 files changed, 5 insertions(+), 3 deletions(-) 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 cf2b20f9fa13dc1f5465d4350678d34e8e6fb566..2cb45dc9e6993e1b0ab34ed44aead710670acf55 100644 GIT binary patch delta 1355 zcma)6ZD^ZS6u#%4H+j=EX_My7*PAp+n>5v>-O{O)vM-xWR@c!b*(`INE1Aurw$iRm z+qwO4RiT1{O-_Ey{VF0N8^Z8a*Z!Ey4{(TJgD7+|*_gk^I_;l*spw52uEh=Za=4s( z?!AX|p65C5@iYARET2*9Sd6Xy)LhGE%W^5^$3O5UF0)H)k*v}|l=}4ar@0Aanh6Ie zR^#Bib@cgq74+0;o^wn^B-v@R!E2kcse?o5@v%{1I{Gbi!aj)Qlc~x{HkA=3(X#_# zigw$m_K-s7O_CvyO&`e`AAN}$0(L+;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