From 01be15d6548ccef800d40af127220dc3cdff667c Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 16 Dec 2013 14:42:21 -0500 Subject: [PATCH] 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 --- lib/Cake/Model/Model.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index b79db9347..970b63b12 100644 --- a/lib/Cake/Model/Model.php +++ b/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;