X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSource.pm;h=04b634c58c9f017e24a3c6f86b41665610024c14;hb=539ffe8768e85b2061aa3bb3616da4f848a582f3;hp=aaa31a339a6048d2b063d1ef5036e567a7683f86;hpb=5c89c897f1377aede43f0e668e79876cec44f55f;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index aaa31a3..04b634c 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -1228,7 +1228,9 @@ sub _resolve_join { $force_left ||= lc($rel_info->{attrs}{join_type}||'') eq 'left'; # the actual seen value will be incremented by the recursion - my $as = ($seen->{$rel} ? join ('_', $rel, $seen->{$rel} + 1) : $rel); + my $as = $self->storage->relname_to_table_alias( + $rel, ($seen->{$rel} && $seen->{$rel} + 1) + ); push @ret, ( $self->_resolve_join($rel, $alias, $seen, [@$jpath], $force_left), @@ -1245,7 +1247,9 @@ sub _resolve_join { } else { my $count = ++$seen->{$join}; - my $as = ($count > 1 ? "${join}_${count}" : $join); + my $as = $self->storage->relname_to_table_alias( + $join, ($count > 1 && $count) + ); my $rel_info = $self->relationship_info($join) or $self->throw_exception("No such relationship ${join}"); @@ -1258,6 +1262,7 @@ sub _resolve_join { : $rel_info->{attrs}{join_type} , -join_path => [@$jpath, $join], + -is_single => (List::Util::first { $rel_info->{attrs}{accessor} eq $_ } (qw/single filter/) ), -alias => $as, -relation_chain_depth => $seen->{-relation_chain_depth} || 0, }, @@ -1579,7 +1584,7 @@ L. =cut sub handle { - return new DBIx::Class::ResultSourceHandle({ + return DBIx::Class::ResultSourceHandle->new({ schema => $_[0]->schema, source_moniker => $_[0]->source_name });