Skip to content

Commit

Permalink
[DoctrineBridge] [DX] Improve condition for exception text in Manager…
Browse files Browse the repository at this point in the history
…Registry to avoid confusion
  • Loading branch information
guilliamxavier authored and nicolas-grekas committed Jan 23, 2020
1 parent c2e1764 commit 0d47fdf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Symfony/Bridge/Doctrine/ManagerRegistry.php
Expand Up @@ -13,6 +13,7 @@

use Doctrine\Persistence\AbstractManagerRegistry;
use ProxyManager\Proxy\LazyLoadingInterface;
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
use Symfony\Component\DependencyInjection\Container;

/**
Expand Down Expand Up @@ -46,7 +47,7 @@ protected function resetService($name)
$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) {
Expand Down

0 comments on commit 0d47fdf

Please sign in to comment.