return 1;
}
-sub _filtered_column {
+sub _column_from_storage {
my ($self, $col, $value) = @_;
return $value unless defined $value;
return $value unless exists $info->{_filter_info};
- my $filter = $info->{_filter_info}{filter};
+ my $filter = $info->{_filter_info}{from_storage};
$self->throw_exception("No inflator for $col") unless defined $filter;
return $self->$filter($value);
}
-sub _unfiltered_column {
+sub _column_to_storage {
my ($self, $col, $value) = @_;
my $info = $self->column_info($col) or
return $value unless exists $info->{_filter_info};
- my $unfilter = $info->{_filter_info}{unfilter};
+ my $unfilter = $info->{_filter_info}{to_storage};
$self->throw_exception("No unfilter for $col") unless defined $unfilter;
return $self->$unfilter($value);
}
my $val = $self->get_column($col);
- return $self->{_filtered_column}{$col} = $self->_filtered_column($col, $val);
+ return $self->{_filtered_column}{$col} = $self->_column_from_storage($col, $val);
}
sub set_value {
my ($self, $col, $filtered) = @_;
- $self->set_column($col, $self->_unfiltered_column($col, $filtered));
+ $self->set_column($col, $self->_column_to_storage($col, $filtered));
delete $self->{_filtered_column}{$col};
exists $self->column_info($key)->{_filter_info}) {
my $val = delete $attrs->{$key};
$self->set_value($key, $val);
- $attrs->{$key} = $self->_unfiltered_column($key, $val)
+ $attrs->{$key} = $self->_column_to_storage($key, $val)
}
}
return $self->next::method($attrs, @rest);
foreach my $key (keys %{$attrs||{}}) {
if ($class->has_column($key) &&
exists $class->column_info($key)->{_filter_info} ) {
- $attrs->{$key} = $class->_unfiltered_column($key, delete $attrs->{$key})
+ $attrs->{$key} = $class->_column_to_storage($key, delete $attrs->{$key})
}
}
my $obj = $class->next::method($attrs, @rest);
my $schema = DBICTest->init_schema();
DBICTest::Schema::Artist->load_components('FilterColumn');
DBICTest::Schema::Artist->filter_column(rank => {
- filter => sub { $_[1] * 2 },
- unfilter => sub { $_[1] / 2 },
+ from_storage => sub { $_[1] * 2 },
+ to_storage => sub { $_[1] / 2 },
});
Class::C3->reinitialize();