Skip to content

Instantly share code, notes, and snippets.

@brzuchal
Last active September 22, 2020 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brzuchal/2057266a1d2a22cdd3ffd397ea34436a to your computer and use it in GitHub Desktop.
Save brzuchal/2057266a1d2a22cdd3ffd397ea34436a to your computer and use it in GitHub Desktop.
<?php
namespace Symfony\Component\Messenger\Bridge\Doctrine\Transport;
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
use Symfony\Contracts\Service\ResetInterface;
class DoctrineTransportFactory implements TransportFactoryInterface
{
public function createTransport(string $dsn, array $options, SerializerInterface $serializer): TransportInterface
{
// access to inner protected static class is allowed
$configuration = self\PostgreSqlConnection::buildConfiguration($dsn, $options);
if (substr($dsn, 8) === 'pgsql://') {
$connection = new self\PostgreSqlConnection($configuration, $driverConnection);
} else {
$connection = new self\Connection($configuration, $driverConnection);
}
return new DoctrineTransport($connection, $serializer);
}
private class Connection implements ResetInterface {
protected function __construct(array $configuration, DBALConnection $driverConnection, SchemaSynchronizer $schemaSynchronizer = null) {}
protected static function buildConfiguration(string $dsn, array $options = []): array {}
}
private class PostgreSqlConnection extends self/Connection {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment