Skip to content

Commit 4a8426e

Browse files
feature #46752 [DependencyInjection] Use lazy-loading ghost object proxies out of the box (nicolas-grekas)
This PR was merged into the 6.2 branch. Discussion ---------- [DependencyInjection] Use lazy-loading ghost object proxies out of the box | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #35345 | License | MIT | Doc PR | - This PR builds on #46751. It also replaces #46458. Instead of using ProxyManager to make lazy services actually lazy, using `LazyGhostObjectTrait` from #46751 allows doing so *out of the box* - aka without the need to install any optional dependencies. When a virtual proxy is required (typically when using [the `proxy` tag](symfony/symfony#27697)), ProxyManager is still required (and the dep remains optional.) But for most services, using `LazyGhostObjectTrait` just works \o/ Commits ------- 58a184826a [DependencyInjection] Use lazy-loading ghost object proxies out of the box
2 parents 1c0e8e3 + 16f52d4 commit 4a8426e

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

Kernel.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Component\HttpKernel;
1313

14-
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
15-
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
1614
use Symfony\Component\Config\Builder\ConfigBuilderGenerator;
1715
use Symfony\Component\Config\ConfigCache;
1816
use Symfony\Component\Config\Loader\DelegatingLoader;
@@ -683,9 +681,6 @@ protected function getContainerBuilder(): ContainerBuilder
683681
if ($this instanceof CompilerPassInterface) {
684682
$container->addCompilerPass($this, PassConfig::TYPE_BEFORE_OPTIMIZATION, -10000);
685683
}
686-
if (class_exists(\ProxyManager\Configuration::class) && class_exists(RuntimeInstantiator::class)) {
687-
$container->setProxyInstantiator(new RuntimeInstantiator());
688-
}
689684

690685
return $container;
691686
}
@@ -701,10 +696,6 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container
701696
// cache the container
702697
$dumper = new PhpDumper($container);
703698

704-
if (class_exists(\ProxyManager\Configuration::class) && class_exists(ProxyDumper::class)) {
705-
$dumper->setProxyDumper(new ProxyDumper());
706-
}
707-
708699
$content = $dumper->dump([
709700
'class' => $class,
710701
'base_class' => $baseClass,

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"symfony/config": "^6.1",
2929
"symfony/console": "^5.4|^6.0",
3030
"symfony/css-selector": "^5.4|^6.0",
31-
"symfony/dependency-injection": "^6.1",
31+
"symfony/dependency-injection": "^6.2",
3232
"symfony/dom-crawler": "^5.4|^6.0",
3333
"symfony/expression-language": "^5.4|^6.0",
3434
"symfony/finder": "^5.4|^6.0",
@@ -51,7 +51,7 @@
5151
"symfony/config": "<6.1",
5252
"symfony/console": "<5.4",
5353
"symfony/form": "<5.4",
54-
"symfony/dependency-injection": "<6.1",
54+
"symfony/dependency-injection": "<6.2",
5555
"symfony/doctrine-bridge": "<5.4",
5656
"symfony/http-client": "<5.4",
5757
"symfony/mailer": "<5.4",

0 commit comments

Comments
 (0)