mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
parent
24abf517d6
commit
49275b8aee
1 changed files with 8 additions and 12 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue