Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit af596bf

Browse filesBrowse files
committed
bug #44309 [Messenger] Leverage DBAL's getNativeConnection() method (derrabus)
This PR was merged into the 5.3 branch. Discussion ---------- [Messenger] Leverage DBAL's getNativeConnection() method | Q | A | ------------- | --- | Branch? | 5.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Doctrine DBAL 3 introduced a new driver middleware system that makes it difficult to unwrap the native PDO connection which we need for Messenger's Postgres transport. If an application would actually make use of the middleware system, accessing the PDO connection would become impossible for us. Because of that, I have added a method `getNativeConnection()` to DBAL with doctrine/dbal#5037. This PR leverages this new method. Commits ------- cde5ec7 Leverage DBAL's getNativeConnection() method
2 parents c19bc94 + cde5ec7 commit af596bf
Copy full SHA for af596bf

File tree

1 file changed

+7
-3
lines changed
Filter options

1 file changed

+7
-3
lines changed

‎src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,13 @@ public function get(): ?array
7373
$this->listening = true;
7474
}
7575

76-
$wrappedConnection = $this->driverConnection->getWrappedConnection();
77-
if (!$wrappedConnection instanceof \PDO && $wrappedConnection instanceof DoctrinePdoConnection) {
78-
$wrappedConnection = $wrappedConnection->getWrappedConnection();
76+
if (method_exists($this->driverConnection, 'getNativeConnection')) {
77+
$wrappedConnection = $this->driverConnection->getNativeConnection();
78+
} else {
79+
$wrappedConnection = $this->driverConnection->getWrappedConnection();
80+
if (!$wrappedConnection instanceof \PDO && $wrappedConnection instanceof DoctrinePdoConnection) {
81+
$wrappedConnection = $wrappedConnection->getWrappedConnection();
82+
}
7983
}
8084

8185
$notification = $wrappedConnection->pgsqlGetNotify(\PDO::FETCH_ASSOC, $this->configuration['get_notify_timeout']);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.