File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,17 +54,17 @@ public static function connect($group = null, bool $getShared = true)
5454 if (is_array ($ group )) {
5555 $ config = $ group ;
5656 $ group = 'custom- ' . md5 (json_encode ($ config ));
57- }
58-
59- /** @var DbConfig $dbConfig */
60- $ dbConfig = config ('Database ' );
57+ } else {
58+ /** @var DbConfig $dbConfig */
59+ $ dbConfig = config ('Database ' );
6160
62- if ($ group === null ) {
63- $ group = (ENVIRONMENT === 'testing ' ) ? 'tests ' : $ dbConfig ->defaultGroup ;
64- }
61+ if ($ group === null ) {
62+ $ group = (ENVIRONMENT === 'testing ' ) ? 'tests ' : $ dbConfig ->defaultGroup ;
63+ }
6564
66- if (is_string ($ group ) && ! isset ($ dbConfig ->{$ group }) && strpos ($ group , 'custom- ' ) !== 0 ) {
67- throw new InvalidArgumentException ($ group . ' is not a valid database connection group. ' );
65+ if (is_string ($ group ) && ! isset ($ dbConfig ->{$ group }) && strpos ($ group , 'custom- ' ) !== 0 ) {
66+ throw new InvalidArgumentException ($ group . ' is not a valid database connection group. ' );
67+ }
6868 }
6969
7070 if ($ getShared && isset (static ::$ instances [$ group ])) {
You can’t perform that action at this time.
0 commit comments