Browse Source

Don't always wipe a Model's _schema property when calling setSource()

Only wipe the internal schema cache if listSources() returned a useful
list of sources. Otherwise retain the old schema. This lets datasources
that don't implement listSources to be combined with models that define
static schema properties.

Fixes #2467
mark_story 12 years ago
parent
commit
01be15d654
1 changed files with 3 additions and 1 deletions
  1. 3 1
      lib/Cake/Model/Model.php

+ 3 - 1
lib/Cake/Model/Model.php

@@ -1140,7 +1140,9 @@ class Model extends Object implements CakeEventListener {
 				));
 			}
 
-			$this->_schema = null;
+			if ($sources) {
+				$this->_schema = null;
+			}
 		}
 
 		$this->table = $this->useTable = $tableName;