Skip to content

Commit

Permalink
minor #35396 [DoctrineBridge] [DX] Improve condition for exception te…
Browse files Browse the repository at this point in the history
…xt 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 #31047 (comment)
| License       | MIT
| Doc PR        | -

(Targetting 4.4 because 4.3 is already almost EOM)

Commits
-------

0d47fdf [DoctrineBridge] [DX] Improve condition for exception text in ManagerRegistry to avoid confusion
  • Loading branch information
nicolas-grekas committed Jan 23, 2020
2 parents c2e1764 + 0d47fdf commit a1e105e
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 a1e105e

Please sign in to comment.