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
This commit is contained in:
mark_story 2013-12-16 14:42:21 -05:00
parent ef899f0c93
commit 01be15d654

View file

@ -1140,8 +1140,10 @@ class Model extends Object implements CakeEventListener {
));
}
if ($sources) {
$this->_schema = null;
}
}
$this->table = $this->useTable = $tableName;
$this->tableToModel[$this->table] = $this->alias;