Avoid unnecessary calls to ConnectionManager::enumConnectionObjects() in ClassRegistry::init().

Closes #3724
This commit is contained in:
ADmad 2013-03-27 15:44:48 +05:30
parent 342bf65811
commit 733116d15d

View file

@ -109,7 +109,7 @@ class ClassRegistry {
$defaults = $_this->_config['Model'];
}
$count = count($objects);
$availableDs = array_keys(ConnectionManager::enumConnectionObjects());
$availableDs = null;
foreach ($objects as $settings) {
if (is_numeric($settings)) {
@ -153,6 +153,9 @@ class ClassRegistry {
$defaultProperties = $reflection->getDefaultProperties();
if (isset($defaultProperties['useDbConfig'])) {
$useDbConfig = $defaultProperties['useDbConfig'];
if ($availableDs === null) {
$availableDs = array_keys(ConnectionManager::enumConnectionObjects());
}
if (in_array('test_' . $useDbConfig, $availableDs)) {
$useDbConfig = 'test_' . $useDbConfig;
}