my $join_count = $attrs->{seen_join}{$rel};
- my $alias = $self->storage->relname_to_table_alias($rel, $join_count);
+ my $alias = $self->result_source->storage
+ ->relname_to_table_alias($rel, $join_count);
#XXX - temp fix for result_class bug. There likely is a more elegant fix -groditi
delete @{$attrs}{qw(result_class alias)};
sub relname_to_table_alias {
my ($self, $relname, $join_count) = @_;
- my $alias = ($join_count > 1 ? join('_', $relname, $join_count) : $relname);
+ my $alias = ($join_count && $join_count > 1 ?
+ join('_', $relname, $join_count) : $relname);
return $alias;
}