#5645: $useDbConfig does not work when using deferent database in one action
------------------------+---------------------------------------------------
Reporter: niwazoh | Type: Bug
Status: new | Priority: Medium
Milestone: 1.2.x.x | Component: Model
Version: RC3 | Severity: Normal
Keywords: | Php_version: n/a
Cake_version: |
------------------------+---------------------------------------------------
After I update from RC2(rev7296) to RC3(rev7692),[[BR]]
$useDbConfig does not work in case one action has deferent database
access.[[BR]]
[[BR]]
The problem looks like $useDbConfig value overwrite by default value[[BR]]
when action call two models with deferent database access at one action.
At following case, I got this error.(These codes work with RC2)[[BR]]
[[BR]]
faultDetail =
"C:\dev\cake_1_2_rc3\cake\libs\model\datasources\dbo_source.php on line
524"[[BR]]
faultString = "<span style = "color:Red;text-align:left"><b>SQL
Error:</b> 1146: Table 'default_db.options' doesn't exist</span>"[[BR]]
/app/config/database.php
{{{
<?php
class DATABASE_CONFIG
{
var $default = array(
'driver' => 'mysql',
'connect' => 'mysql_connect',
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'default_db',
'prefix' => '',
'encoding' => 'utf8',
);
var $option = array(
'driver' => 'mysql',
'connect' => 'mysql_connect',
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'optional_db',
'prefix' => '',
'encoding' => 'utf8',
);
}
?>
}}}
/app/models/member.php
{{{
<?php
class Member extends AppModel {
}
}}}
/app/models/option.php
{{{
<?php
class Option extends AppModel {
var $useDbConfig = 'option';
}
}}}
/app/controllers/options_controller.php
{{{
<?php
class OptionsController extends AppController {
var $uses = array('Option', 'Member');
function getInfomations() {
$result = array();
$rs = array();
$rs = $this->Member->find('all');
$result['members'] = $rs;
$rs = array();
$rs = $this->Option->find('all');
$result['options'] = $rs;
return $result;
}
}
}}}
--
Ticket URL: <https://trac.cakephp.org/ticket/5645>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---