mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
fixes #6427, default datasource not loaded when ds is specified
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8197 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
a903a4527f
commit
88e0cfa2f8
2 changed files with 26 additions and 5 deletions
|
@ -373,6 +373,10 @@ class Model extends Overloadable {
|
||||||
$this->useTable = $table;
|
$this->useTable = $table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($ds !== null) {
|
||||||
|
$this->useDbConfig = $ds;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_subclass_of($this, 'AppModel')) {
|
if (is_subclass_of($this, 'AppModel')) {
|
||||||
$appVars = get_class_vars('AppModel');
|
$appVars = get_class_vars('AppModel');
|
||||||
$merge = array('_findMethods');
|
$merge = array('_findMethods');
|
||||||
|
|
|
@ -268,6 +268,23 @@ class ModelTest extends CakeTestCase {
|
||||||
$this->assertEqual($TestModel->actsAs, $expected);
|
$this->assertEqual($TestModel->actsAs, $expected);
|
||||||
$this->assertTrue(isset($TestModel->Behaviors->Containable));
|
$this->assertTrue(isset($TestModel->Behaviors->Containable));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* test Model::__construct
|
||||||
|
*
|
||||||
|
* ensure that $actsAS and $_findMethods are merged.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
function testConstructWithAlternateDataSource() {
|
||||||
|
$TestModel =& ClassRegistry::init(array(
|
||||||
|
'class' => 'DoesntMatter', 'ds' => 'test_suite', 'table' => false
|
||||||
|
));
|
||||||
|
$this->assertEqual('test_suite', $TestModel->useDbConfig);
|
||||||
|
|
||||||
|
//deprecated but test it anyway
|
||||||
|
$NewVoid =& new TheVoid(null, false, 'other');
|
||||||
|
$this->assertEqual('other', $NewVoid->useDbConfig);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* testColumnTypeFetching method
|
* testColumnTypeFetching method
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue