From: Rafael Kitover Date: Mon, 24 Oct 2011 21:24:04 +0000 (-0400) Subject: add 'ALL' key for naming hash X-Git-Tag: 0.07011~22 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1aba0deff71118deac7fc9428efe340a619418b0;p=dbsrgits%2FDBIx-Class-Schema-Loader.git add 'ALL' key for naming hash Because I earlier added the 'force_ascii' parameter for the naming hash, I now add the 'ALL' key to set 'relationships', 'monikers' and 'column_accessors' in one shot. This lets you do: naming => { ALL => 'v8', force_ascii => 1 } --- diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 0af7c1d..1633327 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -168,12 +168,26 @@ overwriting a dump made with an earlier version. The option also takes a hashref: - naming => { relationships => 'v8', monikers => 'v8' } + naming => { + relationships => 'v8', + monikers => 'v8', + column_accessors => 'v8', + force_ascii => 1, + } + +or + + naming => { ALL => 'v8', force_ascii => 1 } The keys are: =over 4 +=item ALL + +Set L, L and L to the specified +value. + =item relationships How to name relationship accessors. @@ -947,10 +961,16 @@ sub new { column_accessors => $naming_ver, }; } + elsif (ref $self->naming eq 'HASH' && exists $self->naming->{ALL}) { + my $val = delete $self->naming->{ALL}; + + $self->naming->{$_} = $val + foreach qw/relationships monikers column_accessors/; + } if ($self->naming) { - for (values %{ $self->naming }) { - $_ = $CURRENT_V if $_ eq 'current'; + foreach my $key (qw/relationships monikers column_accessors/) { + $self->naming->{$key} = $CURRENT_V if $self->naming->{$key} eq 'current'; } } $self->{naming} ||= {};