From: Rafael Kitover Date: Sat, 19 Feb 2011 11:38:54 +0000 (-0500) Subject: rename column_accessor_map -> col_accessor_map X-Git-Tag: 0.07008~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-Schema-Loader.git;a=commitdiff_plain;h=3fea497fec40754dfbe468328ab1319fc9403856 rename column_accessor_map -> col_accessor_map --- diff --git a/Changes b/Changes index 9f32acd..c8419fe 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - rename column_accessor_map to col_accessor_map, the old alias still + works + 0.07007 2011-02-15 10:00:07 - bump DBIx::Class dep to 0.08127 - fix MSSQL data types for native client and EasySoft driver diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 7e7c3ab..86cacf5 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -40,7 +40,7 @@ __PACKAGE__->mk_group_ro_accessors('simple', qw/ skip_relationships skip_load_external moniker_map - column_accessor_map + col_accessor_map custom_column_info inflect_singular inflect_plural @@ -310,7 +310,7 @@ together. Examples: stations_visited | StationVisited routeChange | RouteChange -=head2 column_accessor_map +=head2 col_accessor_map Same as moniker_map, but for column accessor names. If a coderef is passed, the code is called with arguments of @@ -564,6 +564,10 @@ by L. sub new { my ( $class, %args ) = @_; + if (exists $args{column_accessor_map}) { + $args{col_accessor_map} = delete $args{column_accessor_map}; + } + my $self = { %args }; # don't lose undef options @@ -1638,7 +1642,7 @@ EOF } } -# use the same logic to run moniker_map, column_accessor_map, and +# use the same logic to run moniker_map, col_accessor_map, and # relationship_name_map sub _run_user_map { my ( $self, $map, $default_code, $ident, @extra ) = @_; @@ -1676,7 +1680,7 @@ sub _make_column_accessor_name { my ($self, $column_name, $column_context_info ) = @_; my $accessor = $self->_run_user_map( - $self->column_accessor_map, + $self->col_accessor_map, sub { $self->_default_column_accessor_name( shift ) }, $column_name, $column_context_info, diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm index 1900cc3..bcd5944 100644 --- a/t/lib/dbixcsl_common_tests.pm +++ b/t/lib/dbixcsl_common_tests.pm @@ -95,14 +95,14 @@ sub run_tests { my $extra_count = $self->{extra}{count} || 0; - my $column_accessor_map_tests = 5; + my $col_accessor_map_tests = 5; my $num_rescans = 5; $num_rescans-- if $self->{vendor} =~ /^(?:sybase|mysql)\z/i; $num_rescans++ if $self->{vendor} eq 'mssql'; $num_rescans++ if $self->{vendor} eq 'Firebird'; plan tests => @connect_info * - (188 + $num_rescans * $column_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0)); + (188 + $num_rescans * $col_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0)); foreach my $info_idx (0..$#connect_info) { my $info = $connect_info[$info_idx]; @@ -221,7 +221,7 @@ sub setup_schema { use_moose => $ENV{SCHEMA_LOADER_TESTS_USE_MOOSE}, col_collision_map => { '^(can)\z' => 'caught_collision_%s' }, rel_collision_map => { '^(set_primary_key)\z' => 'caught_rel_collision_%s' }, - column_accessor_map => \&test_column_accessor_map, + col_accessor_map => \&test_col_accessor_map, %{ $self->{loader_options} || {} }, ); @@ -635,7 +635,7 @@ sub test_schema { isa_ok( $rs_rel4->first, $class4); is( $class4->column_info('crumb_crisp_coating')->{accessor}, 'trivet', - 'column_accessor_map is being run' ); + 'col_accessor_map is being run' ); # check rel naming with prepositions ok ($rsobj4->result_source->has_relationship('loader_test5s_to'), @@ -1917,12 +1917,12 @@ sub rescan_without_warnings { return $conn->rescan; } -sub test_column_accessor_map { +sub test_col_accessor_map { my ( $column_name, $default_name, $context ) = @_; if( lc($column_name) eq 'crumb_crisp_coating' ) { - is( $default_name, 'crumb_crisp_coating', 'column_accessor_map was passed the default name' ); - ok( $context->{$_}, "column_accessor_map func was passed the $_" ) + is( $default_name, 'crumb_crisp_coating', 'col_accessor_map was passed the default name' ); + ok( $context->{$_}, "col_accessor_map func was passed the $_" ) for qw( table_name table_class table_moniker schema_class ); return 'trivet';