[Messenger][Doctrine] Avoid early db access for pgsql detection

This commit is contained in:
Robin Chalas 2020-10-18 02:10:46 +02:00
parent 6bbab591c8
commit c4cc4a338b

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\Messenger\Bridge\Doctrine\Transport;
use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
use Doctrine\Persistence\ConnectionRegistry;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Symfony\Component\Messenger\Exception\TransportException;
@ -47,7 +48,7 @@ class DoctrineTransportFactory implements TransportFactoryInterface
throw new TransportException(sprintf('Could not find Doctrine connection from Messenger DSN "%s".', $dsn), 0, $e);
}
if ($useNotify && ($wrappedConnection = $driverConnection->getWrappedConnection()) && method_exists($wrappedConnection, 'pgsqlGetNotify')) {
if ($useNotify && $driverConnection->getDriver() instanceof AbstractPostgreSQLDriver) {
$connection = new PostgreSqlConnection($configuration, $driverConnection);
} else {
$connection = new Connection($configuration, $driverConnection);