From: Arthur Axel "fREW" Schmidt Date: Tue, 13 Apr 2010 16:09:57 +0000 (+0000) Subject: change names wrap accessors X-Git-Tag: v0.08122~72^2~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=956f4141284c6b2f216de47a09ffa16928df38fc;p=dbsrgits%2FDBIx-Class.git change names wrap accessors --- diff --git a/lib/DBIx/Class/FilterColumn.pm b/lib/DBIx/Class/FilterColumn.pm index 46aea8f..2425986 100644 --- a/lib/DBIx/Class/FilterColumn.pm +++ b/lib/DBIx/Class/FilterColumn.pm @@ -49,7 +49,7 @@ sub _unfiltered_column { return $self->$unfilter($value); } -sub get_filtered_column { +sub get_value { my ($self, $col) = @_; $self->throw_exception("$col is not a filtered column") @@ -63,7 +63,7 @@ sub get_filtered_column { return $self->{_filtered_column}{$col} = $self->_filtered_column($col, $val); } -sub set_filtered_column { +sub set_value { my ($self, $col, $filtered) = @_; $self->set_column($col, $self->_unfiltered_column($col, $filtered)); @@ -73,15 +73,18 @@ sub set_filtered_column { return $filtered; } -sub get_column { - my ($self, $column) = @_; - - if (exists $self->{_filtered_column}{$column}) { - return $self->store_column($column, - $self->_unfiltered_column($column, $self->{_filtered_column}{$column})); +sub register_column { + my ($class, $col, $info) = @_; + my $acc = $col; + if (exists $info->{accessor}) { + return unless defined $info->{accessor}; + $acc = [ $info->{accessor}, $col ]; + } + if ( exists $self->column_info($col)->{_filter_info} ) { + $class->mk_group_accessors(value => $acc); + } else { + $class->mk_group_accessors(column => $acc); } - - return $self->next::method($column); } 1; diff --git a/t/row/filter_column.t b/t/row/filter_column.t new file mode 100644 index 0000000..da7283e --- /dev/null +++ b/t/row/filter_column.t @@ -0,0 +1,7 @@ +use strict; +use warnings; + +use Test::More; +use Test::Exception; +use lib qw(t/lib); +use DBICTest;