$self->column_info($col)->{_filter_info} = $attrs;
my $acc = $self->column_info($col)->{accessor};
- $self->mk_group_accessors('value' => [ (defined $acc ? $acc : $col), $col]);
+ $self->mk_group_accessors(filtered_column => [ (defined $acc ? $acc : $col), $col]);
return 1;
}
return $value unless exists $info->{_filter_info};
- my $filter = $info->{_filter_info}{from_storage};
+ my $filter = $info->{_filter_info}{filter_from_storage};
$self->throw_exception("No inflator for $col") unless defined $filter;
return $self->$filter($value);
return $value unless exists $info->{_filter_info};
- my $unfilter = $info->{_filter_info}{to_storage};
+ my $unfilter = $info->{_filter_info}{filter_to_storage};
$self->throw_exception("No unfilter for $col") unless defined $unfilter;
return $self->$unfilter($value);
}
-sub get_value {
+sub get_filtered_column {
my ($self, $col) = @_;
$self->throw_exception("$col is not a filtered column")
return $self->{_filtered_column}{$col} = $self->_column_from_storage($col, $val);
}
-sub set_value {
+sub set_filtered_column {
my ($self, $col, $filtered) = @_;
$self->set_column($col, $self->_column_to_storage($col, $filtered));
if ($self->has_column($key) &&
exists $self->column_info($key)->{_filter_info}) {
my $val = delete $attrs->{$key};
- $self->set_value($key, $val);
+ $self->set_filtered_column($key, $val);
$attrs->{$key} = $self->_column_to_storage($key, $val)
}
}
my $schema = DBICTest->init_schema();
DBICTest::Schema::Artist->load_components('FilterColumn');
DBICTest::Schema::Artist->filter_column(rank => {
- from_storage => sub { $_[1] * 2 },
- to_storage => sub { $_[1] / 2 },
+ filter_from_storage => sub { $_[1] * 2 },
+ filter_to_storage => sub { $_[1] / 2 },
});
Class::C3->reinitialize();