Merging recent changes in 1.2 datasources into 1.1

Refactored Model::setSource() to remove unneeded code

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5596 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-08-29 00:16:13 +00:00
parent 24abf517d6
commit 49275b8aee

View file

@ -731,24 +731,20 @@ class Model extends Overloadable {
$this->setDataSource($this->useDbConfig);
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$db->cacheSources = $this->cacheSources;
if ($db->isInterfaceSupported('listSources')) {
$sources = $db->listSources();
if (is_array($sources) && !in_array(low($this->tablePrefix . $tableName), array_map('low', $sources))) {
return $this->cakeError('missingTable', array(array(
'className' => $this->name,
'table' => $this->tablePrefix . $tableName
)));
} else {
$this->table = $this->useTable = $tableName;
$this->tableToModel[$this->table] = $this->name;
$this->_tableInfo = null;
$this->loadInfo();
'className' => $this->name,
'table' => $this->tablePrefix . $tableName)));
}
} else {
$this->table = $this->useTable = $tableName;
$this->tableToModel[$this->table] = $this->name;
$this->loadInfo();
$this->_tableInfo = null;
}
$this->table = $this->useTable = $tableName;
$this->tableToModel[$this->table] = $this->name;
$this->loadInfo();
}
/**
* This function does two things: 1) it scans the array $one for the primary key,