$attrs->{where}, $attrs
);
- return (@data ? ($self->_construct_object(@data))[0] : ());
+ return (@data ? ($self->_construct_object(@data))[0] : undef);
}
# _is_unique_query
? @{delete $self->{stashed_row}}
: $self->cursor->next
);
- return unless (@row);
+ return undef unless (@row);
my ($row, @more) = $self->_construct_object(@row);
$self->{stashed_objects} = \@more if @more;
return $row;
my $join_count = $seen->{$rel};
my $alias = ($join_count > 1 ? join('_', $rel, $join_count) : $rel);
- $self->_source_handle->schema->resultset($rel_obj->{class})->search_rs(
- undef, {
- %{$self->{attrs}||{}},
- join => undef,
- prefetch => undef,
- select => undef,
- as => undef,
- alias => $alias,
- where => $self->{cond},
- seen_join => $seen,
- from => $from,
- });
+ #XXX - temp fix for result_class bug. There likely is a more elegant fix -groditi
+ my %attrs = %{$self->{attrs}||{}};
+ delete $attrs{result_class};
+
+ my $new_cache;
+
+ if (my $cache = $self->get_cache) {
+ if ($cache->[0] && $cache->[0]->related_resultset($rel)->get_cache) {
+ $new_cache = [ map { @{$_->related_resultset($rel)->get_cache} }
+ @$cache ];
+ }
+ }
+
+ my $new = $self->_source_handle
+ ->schema
+ ->resultset($rel_obj->{class})
+ ->search_rs(
+ undef, {
+ %attrs,
+ join => undef,
+ prefetch => undef,
+ select => undef,
+ as => undef,
+ alias => $alias,
+ where => $self->{cond},
+ seen_join => $seen,
+ from => $from,
+ });
+ $new->set_cache($new_cache) if $new_cache;
+ $new;
};
}