Merge branch 'master' into 2.5

This commit is contained in:
mark_story 2013-11-21 21:46:21 -05:00
commit 71312932e8
4 changed files with 22 additions and 19 deletions
lib/Cake/Model

View file

@ -1127,10 +1127,13 @@ class Model extends Object implements CakeEventListener {
public function setSource($tableName) {
$this->setDataSource($this->useDbConfig);
$db = ConnectionManager::getDataSource($this->useDbConfig);
$db->cacheSources = ($this->cacheSources && $db->cacheSources);
if (method_exists($db, 'listSources')) {
$restore = $db->cacheSources;
$db->cacheSources = ($restore && $this->cacheSources);
$sources = $db->listSources();
$db->cacheSources = $restore;
if (is_array($sources) && !in_array(strtolower($this->tablePrefix . $tableName), array_map('strtolower', $sources))) {
throw new MissingTableException(array(
'table' => $this->tablePrefix . $tableName,