Skip to content

Commit

Permalink
Avoid unnecessary calls to ConnectionManager::enumConnectionObjects()…
Browse files Browse the repository at this point in the history
… in ClassRegistry::init().

Closes #3724
  • Loading branch information
ADmad committed Mar 27, 2013
1 parent 342bf65 commit 733116d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Cake/Utility/ClassRegistry.php
Expand Up @@ -109,7 +109,7 @@ public static function init($class, $strict = false) {
$defaults = $_this->_config['Model'];
}
$count = count($objects);
$availableDs = array_keys(ConnectionManager::enumConnectionObjects());
$availableDs = null;

foreach ($objects as $settings) {
if (is_numeric($settings)) {
Expand Down Expand Up @@ -153,6 +153,9 @@ public static function init($class, $strict = false) {
$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;
}
Expand Down

0 comments on commit 733116d

Please sign in to comment.