Skip to content

Commit 0d47fdf

Browse files
guilliamxaviernicolas-grekas
authored andcommitted
[DoctrineBridge] [DX] Improve condition for exception text in ManagerRegistry to avoid confusion
1 parent c2e1764 commit 0d47fdf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Bridge/Doctrine/ManagerRegistry.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Doctrine\Persistence\AbstractManagerRegistry;
1515
use ProxyManager\Proxy\LazyLoadingInterface;
16+
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
1617
use Symfony\Component\DependencyInjection\Container;
1718

1819
/**
@@ -46,7 +47,7 @@ protected function resetService($name)
4647
$manager = $this->container->get($name);
4748

4849
if (!$manager instanceof LazyLoadingInterface) {
49-
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".'));
50+
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".'));
5051
}
5152
$manager->setProxyInitializer(\Closure::bind(
5253
function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {

0 commit comments

Comments
 (0)