Fixes #3118 Prefix in models : can't use allow empty tablePrefix with a prefix defined in DATABASE_CONFIG

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5593 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-08-28 21:44:47 +00:00
parent 7793b4f5c0
commit 0161f4f6d7
2 changed files with 2 additions and 5 deletions

View file

@ -446,10 +446,7 @@ class DboSource extends DataSource {
*/ */
function fullTableName($model, $quote = true) { function fullTableName($model, $quote = true) {
if (is_object($model)) { if (is_object($model)) {
$table = $model->table; $table = $model->tablePrefix . $model->table;
if ($model->tablePrefix != null && !empty($model->tablePrefix)) {
$table = $model->tablePrefix . $table;
}
} elseif (isset($this->config['prefix'])) { } elseif (isset($this->config['prefix'])) {
$table = $this->config['prefix'] . strval($model); $table = $this->config['prefix'] . strval($model);
} else { } else {

View file

@ -1924,7 +1924,7 @@ class Model extends Overloadable {
} }
$db =& ConnectionManager::getDataSource($this->useDbConfig); $db =& ConnectionManager::getDataSource($this->useDbConfig);
if (!empty($db->config['prefix']) && $this->tablePrefix !== false) { if (!empty($db->config['prefix']) && $this->tablePrefix === null) {
$this->tablePrefix = $db->config['prefix']; $this->tablePrefix = $db->config['prefix'];
} }