minor #35396 [DoctrineBridge] [DX] Improve condition for exception text in ManagerRegistry to avoid confusion (guilliamxavier)

This PR was submitted for the 4.4 branch but it was merged into the 4.3 branch instead.

Discussion
----------

[DoctrineBridge] [DX] Improve condition for exception text in ManagerRegistry to avoid confusion

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yesish
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix https://github.com/symfony/symfony/pull/31047#issuecomment-575548372
| License       | MIT
| Doc PR        | -

(Targetting 4.4 because 4.3 is already almost EOM)

Commits
-------

0d47fdfb49 [DoctrineBridge] [DX] Improve condition for exception text in ManagerRegistry to avoid confusion
This commit is contained in:
Nicolas Grekas 2020-01-23 11:55:20 +01:00
commit a1e105ee6c
1 changed files with 2 additions and 1 deletions

View File

@ -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) {