Skip to content

Commit 5a1463c

Browse files
authored
Remove connection from Context on close
Clear the connection from the Context before disconnecting.
1 parent ded41bd commit 5a1463c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/DatabaseManager.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ private function getHeartbeatSql(string $driver): string
141141
*/
142142
protected function closeAndFreeConnection($connection): void
143143
{
144+
// Remove connection from Context
145+
$name = $connection->getNameWithReadWriteType();
146+
$key = "database.connections.$name";
147+
Context::set($key, null);
148+
144149
$connection->disconnect();
145150
$clearProperties = function () {
146151
$this->queryGrammar = null;

0 commit comments

Comments
 (0)