From: David Kamholz Date: Tue, 11 Jul 2006 08:29:52 +0000 (+0000) Subject: fixation X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c9cc7257097c16c54b6f74494fb49f553b4c82f1;p=dbsrgits%2FDBIx-Class-Historic.git fixation --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 20d842d..6004957 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1439,6 +1439,27 @@ sub related_resultset { }; } +sub _resolve_from { + my ($self) = @_; + my $source = $self->result_source; + my $attrs = $self->{attrs}; + + my $from = $attrs->{_parent_from} + || [ { $attrs->{alias} => $source->from } ]; +# ? [ @{$attrs->{_parent_from}} ] +# : undef; + + my $seen = { %{$attrs->{seen_join}||{}} }; + + if ($attrs->{join}) { + push(@{$from}, + $source->resolve_join($attrs->{join}, $attrs->{alias}, $seen) + ); + } + + return ($from,$seen); +} + sub _resolved_attrs { my $self = shift; return $self->{_attrs} if $self->{_attrs}; @@ -1482,10 +1503,8 @@ sub _resolved_attrs { push(@{$attrs->{as}}, @$adds); } - $attrs->{from} ||= [ { 'me' => $source->from } ]; - if ($attrs->{_parent_from}) { - push @{$attrs->{from}}, @{delete $attrs->{_parent_from}}; - } + $attrs->{from} ||= delete $attrs->{_parent_from} + || [ { 'me' => $source->from } ]; if (exists $attrs->{join} || exists $attrs->{prefetch}) { @@ -1527,25 +1546,6 @@ sub _resolved_attrs { return $self->{_attrs} = $attrs; } -sub _resolve_from { - my ($self) = @_; - my $source = $self->result_source; - my $attrs = $self->{attrs}; - - my $from = [ @{$attrs->{_parent_from}||[]} ]; -# || [ { $attrs->{alias} => $source->from } ]; - - my $seen = { %{$attrs->{seen_join}||{}} }; - - if ($attrs->{join}) { - push(@{$from}, - $source->resolve_join($attrs->{join}, $attrs->{alias}, $seen) - ); - } - - return ($from,$seen); -} - sub _merge_attr { my ($self, $a, $b) = @_; return $b unless $a;