Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf6fecb5

Browse files
committed
bug#46443 [DoctrineBridge] Don't reinit managers when they are proxied as ghost objects (nicolas-grekas)
This PR was merged into the 4.4 branch.Discussion----------[DoctrineBridge] Don't reinit managers when they are proxied as ghost objects| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | -| License | MIT| Doc PR | -Paving the way to#35345Interface `GhostObjectInterface` extends `LazyLoadingInterface` but breaks LSP because `setProxyInitializer()` takes another kind of closure as argument.This won't solve#35216 since resetting a closed entity manager won't happen anymore if we start to use ghost object proxies. But at least this code won't explode./cc@ostrolucky any idea what we could put inside the added "if" to solve#35216? Would you be up to submit a PR doing that, branch 6.2 I guess since that'd be a new feature?Commits-------1dbf3a6 [DoctrineBridge] Don't reinit managers when they are proxied as ghost objects
2 parents11a87ad +1dbf3a6 commitf6fecb5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎src/Symfony/Bridge/Doctrine/ManagerRegistry.php‎

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

1414
useDoctrine\Persistence\AbstractManagerRegistry;
15+
useProxyManager\Proxy\GhostObjectInterface;
1516
useProxyManager\Proxy\LazyLoadingInterface;
1617
useSymfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
1718
useSymfony\Component\DependencyInjection\Container;
1819

1920
/**
2021
* References Doctrine connections and entity/document managers.
2122
*
22-
* @authorLukas Kahwe Smith <smith@pooteeweet.org>
23+
* @author Lukas Kahwe Smith <smith@pooteeweet.org>
2324
*/
2425
abstractclass ManagerRegistryextends AbstractManagerRegistry
2526
{
@@ -53,6 +54,9 @@ protected function resetService($name)
5354
if (!$managerinstanceof LazyLoadingInterface) {
5455
thrownew \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 ($managerinstanceof GhostObjectInterface) {
58+
thrownew \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->normalizedIds[$normalizedId =strtolower($name)])) {// BC with DI v3.4

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp