Skip to content

Commit

Permalink
[Messenger] Fix unwrapping the Postgres connection in DBAL 3
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander M. Turek <[email protected]>
  • Loading branch information
derrabus committed Oct 21, 2021
1 parent e11b875 commit 971b7d5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Transport/PostgreSqlConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Messenger\Bridge\Doctrine\Transport;

use Doctrine\DBAL\Driver\PDO\Connection as DoctrinePdoConnection;
use Doctrine\DBAL\Schema\Table;

/**
Expand Down Expand Up @@ -72,7 +73,12 @@ public function get(): ?array
$this->listening = true;
}

$notification = $this->driverConnection->getWrappedConnection()->pgsqlGetNotify(\PDO::FETCH_ASSOC, $this->configuration['get_notify_timeout']);
$wrappedConnection = $this->driverConnection->getWrappedConnection();
if (!$wrappedConnection instanceof \PDO && $wrappedConnection instanceof DoctrinePdoConnection) {
$wrappedConnection = $wrappedConnection->getWrappedConnection();
}

$notification = $wrappedConnection->pgsqlGetNotify(\PDO::FETCH_ASSOC, $this->configuration['get_notify_timeout']);
if (
// no notifications, or for another table or queue
(false === $notification || $notification['message'] !== $this->configuration['table_name'] || $notification['payload'] !== $this->configuration['queue_name']) &&
Expand Down

0 comments on commit 971b7d5

Please sign in to comment.