Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"doctrine/orm": "^2.17 || ^3.0",
"symfony/doctrine-bridge": "^6.4 || ^7.4 || ^8.0",
"doctrine/dbal": "^3.4",
"macpaw/schema-context-bundle": "^2.0.6"
"macpaw/schema-context-bundle": "^2.0.7"
},
"require-dev": {
"doctrine/migrations": "^3.6",
Expand Down
24 changes: 21 additions & 3 deletions src/Doctrine/SchemaConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@ public static function setLogger(DebugLogger $logger): void
self::$logger = $logger;
}

public function close(): void
{
self::$logger?->logSchemaResetByConnectionClose($this->currentSchema ?? '');

$this->currentSchema = null;

parent::close();
}

public function rollBack(): bool
{
self::$logger?->logSchemaResetByTransactionRollback($this->currentSchema ?? '');

$this->currentSchema = null;

return parent::rollBack();
}

public function connect(): bool
{
$isNewConnection = parent::connect();
Expand All @@ -43,8 +61,8 @@ public function connect(): bool

if ($this->currentSchema === $schema) {
if (self::$logger !== null) {
$actualScheme = $this->getActualSearchPath();
self::$logger->logSkipSearchPath($schema, $actualScheme);
self::$logger->logActualSearchPath($this->getActualSearchPath());
self::$logger->logSkipSearchPath($schema, $this->isTransactionActive());
}

return $isNewConnection;
Expand Down Expand Up @@ -89,7 +107,7 @@ private function applySearchPath(string $schema, bool $isNewConnection): void
if ($this->_conn !== null) {
$schema = $this->getDatabasePlatform()->quoteIdentifier($schema);

self::$logger?->logApplySearchPath($schema, $isNewConnection);
self::$logger?->logApplySearchPath($schema, $isNewConnection, $this->isTransactionActive());

$this->_conn->exec('SET search_path TO ' . $schema);
}
Expand Down
Loading