Write correct odd (not even) relchain depth on primary joins
Peter Rabbitson [Sun, 27 Jan 2013 19:10:34 +0000 (20:10 +0100)]
lib/DBIx/Class/ResultSource.pm

index 97c37eb..d33a74d 100644 (file)
@@ -1600,7 +1600,7 @@ sub _resolve_join {
                   first { $rel_info->{attrs}{accessor} eq $_ } (qw/single filter/)
                 ),
                -alias => $as,
-               -relation_chain_depth => $seen->{-relation_chain_depth} || 0,
+               -relation_chain_depth => ( $seen->{-relation_chain_depth} || 0 ) + 1,
              },
              scalar $self->_resolve_condition($rel_info->{cond}, $as, $alias, $join)
           ];