From: Rafael Kitover Date: Mon, 16 May 2011 13:13:04 +0000 (-0400) Subject: only set use_namespaces=1 if naming is set for dynamic schemas X-Git-Tag: 0.07011~120 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9c703ffb5c4fb7eb918a6e3463b1f07472c6dca2;p=dbsrgits%2FDBIx-Class-Schema-Loader.git only set use_namespaces=1 if naming is set for dynamic schemas --- diff --git a/Changes b/Changes index e3a5d7c..25ab433 100644 --- a/Changes +++ b/Changes @@ -11,10 +11,9 @@ Revision history for Perl extension DBIx::Class::Schema::Loader - support for unicode Firebird data types - handle "use warnings FATAL => 'all';" in custom/external content (RT#59849) - - for dynamic schemas, if the schema is loaded in backcompat mode, or - naming => { monikers => 'v4' } is not explicitly set, will - automatically turn on use_namespaces=1 as well. Set use_namespaces=0 - to disable this behavior (RT#59849) + - for dynamic schemas, if the naming option is set, will automatically + turn on use_namespaces=1 as well. Set use_namespaces=0 to disable + this behavior (RT#59849) 0.07010 2011-03-04 08:26:31 - add result_component_map option diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 6e11679..006aaad 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -64,6 +64,7 @@ __PACKAGE__->mk_group_ro_accessors('simple', qw/ monikers dynamic naming + naming_set datetime_timezone datetime_locale config_file @@ -708,6 +709,13 @@ sub new { $self->version_to_dump($DBIx::Class::Schema::Loader::VERSION); $self->schema_version_to_dump($DBIx::Class::Schema::Loader::VERSION); + if (not defined $self->naming) { + $self->naming_set(0); + } + else { + $self->naming_set(1); + } + if ((not ref $self->naming) && defined $self->naming) { my $naming_ver = $self->naming; $self->{naming} = { @@ -773,14 +781,13 @@ EOF $self->_upgrading_from('v4'); } - $self->naming->{relationships} ||= 'v4'; - $self->naming->{monikers} ||= 'v4'; - - if ((not defined $self->use_namespaces) - && $self->naming->{monikers} ne 'v4') { + if ((not defined $self->use_namespaces) && (not $self->naming_set)) { $self->use_namespaces(1); } + $self->naming->{relationships} ||= 'v4'; + $self->naming->{monikers} ||= 'v4'; + if ($self->use_namespaces) { $self->_upgrading_from_load_classes(1); }