mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merging fixes and enhancements into trunk
Revision: [1914] Adding prefix setting to the database config class. Setting the value here will use the prefix for all models. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1915 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
d09a48d882
commit
50a71fa777
5 changed files with 17 additions and 4 deletions
|
@ -6,4 +6,4 @@
|
|||
// +---------------------------------------------------------------------------------------------------+ //
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
0.10.8.1913 RC 4
|
||||
0.10.8.1915 RC 4
|
|
@ -64,14 +64,16 @@ class DATABASE_CONFIG
|
|||
'host' => 'localhost',
|
||||
'login' => 'user',
|
||||
'password' => 'password',
|
||||
'database' => 'project_name' );
|
||||
'database' => 'project_name',
|
||||
'prefix' => '');
|
||||
|
||||
var $test = array('driver' => 'mysql',
|
||||
'connect' => 'mysql_pconnect',
|
||||
'host' => 'localhost',
|
||||
'login' => 'user',
|
||||
'password' => 'password',
|
||||
'database' => 'project_name-test');
|
||||
'database' => 'project_name-test',
|
||||
'prefix' => '');
|
||||
}
|
||||
|
||||
?>
|
|
@ -238,7 +238,7 @@ function loadController ($name)
|
|||
}
|
||||
if($name === null)
|
||||
{
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
if(!class_exists($name.'Controller'))
|
||||
{
|
||||
|
|
|
@ -1384,6 +1384,12 @@ class Model extends Object
|
|||
$dataSource = $this->useDbConfig;
|
||||
}
|
||||
$this->db =& ConnectionManager::getDataSource($dataSource);
|
||||
|
||||
if(!empty($this->db->config['prefix']))
|
||||
{
|
||||
$this->tablePrefix = $this->db->config['prefix'];
|
||||
}
|
||||
|
||||
if(empty($this->db) || $this->db == null || !is_object($this->db))
|
||||
{
|
||||
return $this->cakeError('missingConnection',array(array('className' => $this->name)));
|
||||
|
|
|
@ -1387,6 +1387,11 @@ class Model extends Object
|
|||
$dataSource = $this->useDbConfig;
|
||||
}
|
||||
$this->db =& ConnectionManager::getDataSource($dataSource);
|
||||
|
||||
if(!empty($this->db->config['prefix']))
|
||||
{
|
||||
$this->tablePrefix = $this->db->config['prefix'];
|
||||
}
|
||||
if(empty($this->db) || $this->db == null || !is_object($this->db))
|
||||
{
|
||||
return $this->cakeError('missingConnection',array(array('className' => $this->name)));
|
||||
|
|
Loading…
Reference in a new issue