mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Avoid unnecessary calls to ConnectionManager::enumConnectionObjects() in ClassRegistry::init().
Closes #3724
This commit is contained in:
parent
342bf65811
commit
733116d15d
1 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue