From: Matt S Trout Date: Sun, 17 Nov 2013 02:53:33 +0000 (+0000) Subject: fix condition extraction for new_result X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4c1bd8b2092e3fe47dd51b2a99a94c31f22c8068;p=dbsrgits%2FDBIx-Class.git fix condition extraction for new_result --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index e329034..3b1f849 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -2504,8 +2504,11 @@ sub _merge_with_rscond { } } elsif (ref $self->{cond} eq 'REF' and ref ${$self->{cond}} eq 'HASH') { - %new_data = %{$self->result_source - ->_extract_fixed_values_for(${$self->{cond}}, $alias)}; + %new_data = %{$self->_remove_alias( + $self->result_source + ->_extract_fixed_values_for(${$self->{cond}}), + $alias + )}; } else { $self->throw_exception( diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 04f02cb..ea0adac 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -1564,16 +1564,22 @@ sub _extract_fixed_conditions_for { ) { my ($l, $r) = @{$n->{args}}; if ( - is_Identifier($r) and @{$r->{elements}} == 2 - and (!$alias or $r->{elements}[0] eq $alias) + is_Identifier($r) and ( + !$alias + or (@{$r->{elements}} == 2 + and $r->{elements}[0] eq $alias) + ) ) { ($l, $r) = ($r, $l); } if ( - is_Identifier($l) and @{$l->{elements}} == 2 - and (!$alias or $l->{elements}[0] eq $alias) + is_Identifier($l) and ( + !$alias + or (@{$l->{elements}} == 2 + and $l->{elements}[0] eq $alias) + ) ) { - $found{$l->{elements}[1]} = $r; + $found{$alias ? $l->{elements}[1] : join('.',@{$l->{elements}})} = $r; } } }