my %new = (
%{ $self->_remove_alias($values, $alias) },
%{ $self->_remove_alias($collapsed_cond, $alias) },
- _source_handle => $self->_source_handle,
);
- my $obj = $self->result_class->new(\%new);
- return $obj;
+ return $self->result_class->new(\%new,$self->_source_handle);
}
# _collapse_cond
=cut
sub new {
- my ($class, $attrs) = @_;
+ my ($class, $attrs, $source) = @_;
$class = ref $class if ref $class;
my $new = { _column_data => {} };
if ($attrs) {
$new->throw_exception("attrs must be a hashref")
unless ref($attrs) eq 'HASH';
- if (my $source = delete $attrs->{-source_handle}) {
- $new->_source_handle($source);
- }
+
foreach my $k (keys %$attrs) {
$new->throw_exception("No such column $k on $class")
unless $class->has_column($k);
}
}
+ $new->_source_handle($source) if $source;
+
return $new;
}