Skip to content

Commit a1e105e

Browse files
minor symfony#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 symfony#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
2 parents c2e1764 + 0d47fdf commit a1e105e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Bridge/Doctrine/ManagerRegistry.php

Lines changed: 2 additions & 1 deletion
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)