From 0d47fdfb4921fcfa43c71221ad7266fe2e8ddfb7 Mon Sep 17 00:00:00 2001 From: Guilliam Xavier Date: Mon, 20 Jan 2020 10:07:41 +0100 Subject: [PATCH] [DoctrineBridge] [DX] Improve condition for exception text in ManagerRegistry to avoid confusion --- src/Symfony/Bridge/Doctrine/ManagerRegistry.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Doctrine/ManagerRegistry.php b/src/Symfony/Bridge/Doctrine/ManagerRegistry.php index a19be6a0c4..b6e7f19df2 100644 --- a/src/Symfony/Bridge/Doctrine/ManagerRegistry.php +++ b/src/Symfony/Bridge/Doctrine/ManagerRegistry.php @@ -13,6 +13,7 @@ namespace Symfony\Bridge\Doctrine; use Doctrine\Persistence\AbstractManagerRegistry; use ProxyManager\Proxy\LazyLoadingInterface; +use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator; use Symfony\Component\DependencyInjection\Container; /** @@ -46,7 +47,7 @@ abstract class ManagerRegistry extends AbstractManagerRegistry $manager = $this->container->get($name); if (!$manager instanceof LazyLoadingInterface) { - throw new \LogicException('Resetting a non-lazy manager service is not supported. '.(interface_exists(LazyLoadingInterface::class) ? sprintf('Declare the "%s" service as lazy.', $name) : 'Try running "composer require symfony/proxy-manager-bridge".')); + throw new \LogicException('Resetting a non-lazy manager service is not supported. '.(interface_exists(LazyLoadingInterface::class) && class_exists(RuntimeInstantiator::class) ? sprintf('Declare the "%s" service as lazy.', $name) : 'Try running "composer require symfony/proxy-manager-bridge".')); } $manager->setProxyInitializer(\Closure::bind( function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {