Skip to content

Commit 541a55d

Browse files
committed
Merge branch '4.4' into 5.4
* 4.4: [DoctrineBridge] Don't reinit managers when they are proxied as ghost objects Revert "bug #46125 [FrameworkBundle] Always add CacheCollectorPass (fancyweb)"
2 parents 0621ae9 + fbd5b86 commit 541a55d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ManagerRegistry.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
namespace Symfony\Bridge\Doctrine;
1313

1414
use Doctrine\Persistence\AbstractManagerRegistry;
15+
use ProxyManager\Proxy\GhostObjectInterface;
1516
use ProxyManager\Proxy\LazyLoadingInterface;
1617
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
1718
use Symfony\Component\DependencyInjection\Container;
1819

1920
/**
2021
* References Doctrine connections and entity/document managers.
2122
*
22-
* @author Lukas Kahwe Smith <[email protected]>
23+
* @author Lukas Kahwe Smith <[email protected]>
2324
*/
2425
abstract class ManagerRegistry extends AbstractManagerRegistry
2526
{
@@ -53,6 +54,9 @@ protected function resetService($name)
5354
if (!$manager instanceof LazyLoadingInterface) {
5455
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".'));
5556
}
57+
if ($manager instanceof GhostObjectInterface) {
58+
throw new \LogicException('Resetting a lazy-ghost-object manager service is not supported.');
59+
}
5660
$manager->setProxyInitializer(\Closure::bind(
5761
function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {
5862
if (isset($this->aliases[$name])) {

0 commit comments

Comments
 (0)