mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Merge pull request #1200 from ADmad/2.3-classregistry
Avoid unnecessary calls to ConnectionManager::enumConnectionObjects() in...
This commit is contained in:
commit
3e4dd84bcc
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…
Add table
Reference in a new issue