only set use_namespaces=1 if naming is set for dynamic schemas
Rafael Kitover [Mon, 16 May 2011 13:13:04 +0000 (09:13 -0400)]
Changes
lib/DBIx/Class/Schema/Loader/Base.pm

diff --git a/Changes b/Changes
index e3a5d7c..25ab433 100644 (file)
--- 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
index 6e11679..006aaad 100644 (file)
@@ -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);
         }