Skip to content

Commit 67c3d18

Browse files
committed
remove current instance when default database changed
1 parent 10c183a commit 67c3d18

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"email": "[email protected]"
1010
}
1111
],
12-
"version": "0.0.16",
12+
"version": "0.0.17",
1313
"autoload": {
1414
"psr-4": {
1515
"MyDB\\": "src/"

src/MyDB.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ public static function addConfigs(array $configs): void {
8383
self::$configs = array_merge(self::$configs, $configs);
8484
}
8585
public static function setDefault(string $name): void {
86+
if(self::$default !== $name) {
87+
self::$instance = null;
88+
}
8689
self::$default = $name;
87-
self::$instance = null;
8890
}
8991

9092
public function get(string $query, array $params = [], ?Closure $wrapper = null): array {

0 commit comments

Comments
 (0)