mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Adding database prefix check in Model::setDataSource()
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6501 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
5ce4469867
commit
9fbf783286
1 changed files with 2 additions and 2 deletions
|
@ -2384,10 +2384,10 @@ class Model extends Overloadable {
|
|||
$this->useDbConfig = $dataSource;
|
||||
}
|
||||
$db =& ConnectionManager::getDataSource($this->useDbConfig);
|
||||
if (!empty($oldConfig) && isset($oldDb->config['prefix']) && isset($db->config['prefix'])) {
|
||||
if (!empty($oldConfig) && isset($db->config['prefix'])) {
|
||||
$oldDb =& ConnectionManager::getDataSource($oldConfig);
|
||||
|
||||
if (empty($this->tablePrefix) || ($this->tablePrefix == $oldDb->config['prefix'])) {
|
||||
if (empty($this->tablePrefix) || (!isset($oldDb->config['prefix']) || $this->tablePrefix == $oldDb->config['prefix'])) {
|
||||
$this->tablePrefix = $db->config['prefix'];
|
||||
}
|
||||
} elseif (isset($db->config['prefix'])) {
|
||||
|
|
Loading…
Add table
Reference in a new issue