X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FBase.pm;h=e9e30aba68f3a179906e2e2b5e07faf30c493ceb;hb=dc783fab900d073db1fb0e86b709cbb65bd364b7;hp=3b146228af2ae2b20bcaf4b97dbff4bca6c9634c;hpb=5784b2b9d26d61b0673513413597fc5928e480a5;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 3b14622..e9e30ab 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -20,6 +20,7 @@ use File::Temp (); use Class::Unload; use Class::Inspector (); use Scalar::Util 'looks_like_number'; +use DBIx::Class::Schema::Loader::Column; use DBIx::Class::Schema::Loader::Utils qw/split_name dumper_squashed eval_package_without_redefine_warnings class_path slurp_file sigwarn_silencer firstidx uniq/; use DBIx::Class::Schema::Loader::Optional::Dependencies (); use Try::Tiny; @@ -29,7 +30,7 @@ use List::Util qw/all any none/; use File::Temp 'tempfile'; use namespace::clean; -our $VERSION = '0.07043'; +our $VERSION = '0.07045'; __PACKAGE__->mk_group_ro_accessors('simple', qw/ schema @@ -657,10 +658,12 @@ L takes precedence over this. =head2 col_accessor_map -Same as moniker_map, but for column accessor names. If a coderef is +Same as moniker_map, but for column accessor names. The nested +hashref form is traversed according to L, with an +extra level at the bottom for the column name. If a coderef is passed, the code is called with arguments of - the name of the column in the underlying database, + the DBIx::Class::Schema::Loader::Column object for the column, default accessor name that DBICSL would ordinarily give this column, { table_class => name of the DBIC class we are building, @@ -672,8 +675,9 @@ passed, the code is called with arguments of } coderef ref that can be called with a hashref map -the L stringifies to the -unqualified table name. +The L and +L objects stringify to their +unqualified names. =head2 rel_name_map @@ -2489,7 +2493,7 @@ sub _run_user_map { my $default_ident = $default_code->( $ident, @extra ); my $new_ident; if( $map && ref $map eq 'HASH' ) { - if (my @parts = try{ @{ $ident } }) { + if (my @parts = try { @{ $ident } }) { my $part_map = $map; while (@parts) { my $part = shift @parts; @@ -2597,8 +2601,12 @@ sub _setup_src_meta { schema_class => $schema_class, column_info => $info, }; + my $col_obj = DBIx::Class::Schema::Loader::Column->new( + table => $table, + name => $col, + ); - $info->{accessor} = $self->_make_column_accessor_name( $col, $context ); + $info->{accessor} = $self->_make_column_accessor_name( $col_obj, $context ); } $self->_resolve_col_accessor_collisions($table, $col_info);