[DoctrineBridge] [DX] Improve condition for exception text in ManagerRegistry to avoid confusion
This commit is contained in:
parent
c2e17645c2
commit
0d47fdfb49
@ -13,6 +13,7 @@ namespace Symfony\Bridge\Doctrine;
|
|||||||
|
|
||||||
use Doctrine\Persistence\AbstractManagerRegistry;
|
use Doctrine\Persistence\AbstractManagerRegistry;
|
||||||
use ProxyManager\Proxy\LazyLoadingInterface;
|
use ProxyManager\Proxy\LazyLoadingInterface;
|
||||||
|
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
|
||||||
use Symfony\Component\DependencyInjection\Container;
|
use Symfony\Component\DependencyInjection\Container;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,7 +47,7 @@ abstract class ManagerRegistry extends AbstractManagerRegistry
|
|||||||
$manager = $this->container->get($name);
|
$manager = $this->container->get($name);
|
||||||
|
|
||||||
if (!$manager instanceof LazyLoadingInterface) {
|
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(
|
$manager->setProxyInitializer(\Closure::bind(
|
||||||
function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {
|
function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {
|
||||||
|
Reference in New Issue
Block a user