From: Matt S Trout Date: Thu, 6 Jul 2006 21:34:51 +0000 (+0000) Subject: fixup to resultset? X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f8f8516a26a19db6853b7d3f62f005d80274169c;p=dbsrgits%2FDBIx-Class-Historic.git fixup to resultset? --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 79ecccc..4132d5f 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1603,11 +1603,17 @@ sub related_resultset { "search_related: result source '" . $self->result_source->name . "' has no such relationship $rel") unless $rel_obj; - - my $join_count = $self->_resolved_attrs->{seen_join}{$rel}; + + my @live_join_stack = @{$self->{attrs}{_live_join_stack}||[]}; + + # XXX mst: I'm sure this is wrong, somehow + # something with complex joins early on could die on search_rel + # followed by a prefetch. I think. need a test case. + + my $join_count = scalar(grep { $_ eq $rel } @live_join_stack); my $alias = $join_count ? join('_', $rel, $join_count+1) : $rel; - my @live_join_stack = (@{$self->{attrs}{_live_join_stack}||[]}, $rel); + push(@live_join_stack, $rel); my $rs = $self->result_source->schema->resultset($rel_obj->{class})->search( undef, {