X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSet.pm;h=689586f3a64527113f90fcc7373e05a8bc9a606c;hb=96761eee31cc8dc396c224fe33d7f605982250e4;hp=7a405cefcf5fc8e742437b7977cc259e0921c027;hpb=b0596c69b942ab6f63c4f5a767161c1b4f79865b;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 7a405ce..689586f 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -195,12 +195,6 @@ sub search_rs { $our_attrs->{join}, $attrs->{_live_join_h} ) if ($attrs->{_live_join_h}); - if (defined $our_attrs->{prefetch}) { - $our_attrs->{join} = $self->_merge_attr( - $our_attrs->{join}, $our_attrs->{prefetch} - ); - } - my $new_attrs = { %{$our_attrs}, %{$attrs} }; my $where = (@_ ? ( @@ -710,7 +704,7 @@ sub _resolved_attrs { # XXX - lose storable dclone my $record_filter = delete $attrs->{record_filter}; #$attrs = Storable::dclone($attrs || {}); # { %{ $attrs || {} } }; - $attrs = { %{ $attrs || {} } }; + $attrs->{record_filter} = $record_filter if $record_filter; $attrs->{columns} ||= delete $attrs->{cols} if exists $attrs->{cols}; @@ -745,7 +739,16 @@ sub _resolved_attrs { $attrs->{from} ||= [ { $alias => $source->from } ]; $attrs->{seen_join} ||= {}; - if (my $join = delete $attrs->{join}) { + if (exists $attrs->{join} || exists $attrs->{prefetch}) { + + my $join = delete $attrs->{join} || {}; + + if (defined $attrs->{prefetch}) { + $join = $self->_merge_attr( + $join, $attrs->{prefetch} + ); + } + push(@{$attrs->{from}}, $source->resolve_join($join, $alias, $attrs->{seen_join}) );