compatibility with DoctrineBundle 2

This commit is contained in:
Christian Flothmann 2019-11-22 14:37:01 +01:00
parent 996d8a708f
commit 6ff20f0122

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\Messenger\Transport\Doctrine;
use Doctrine\Common\Persistence\ConnectionRegistry;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Symfony\Component\Messenger\Exception\TransportException;
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
@ -26,8 +27,12 @@ class DoctrineTransportFactory implements TransportFactoryInterface
{
private $registry;
public function __construct(RegistryInterface $registry)
public function __construct($registry)
{
if (!$registry instanceof RegistryInterface && !$registry instanceof ConnectionRegistry) {
throw new \TypeError(sprintf('Expected an instance of %s or %s, but got %s.', RegistryInterface::class, ConnectionRegistry::class, \is_object($registry) ? \get_class($registry) : \gettype($registry)));
}
$this->registry = $registry;
}