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

Commitef4a474

Browse files
author
Antanas Arvasevicius
committed
bug#21339 [FrameworkBundle] CachePoolClearerPass fails if "cache.annotations" service is created
1 parent922b7c1 commitef4a474

File tree

3 files changed

+45
-18
lines changed

3 files changed

+45
-18
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
13+
14+
useSymfony\Component\Cache\Adapter\AbstractAdapter;
15+
useSymfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16+
useSymfony\Component\DependencyInjection\ContainerBuilder;
17+
useSymfony\Component\DependencyInjection\Reference;
18+
19+
finalclass CacheAnnotationsMonologInjectorPassimplements CompilerPassInterface
20+
{
21+
/**
22+
* {@inheritdoc}
23+
*/
24+
publicfunctionprocess(ContainerBuilder$container)
25+
{
26+
if (!($container->hasDefinition('cache.annotations') ||$container->hasAlias('cache.annotations'))) {
27+
return;
28+
}
29+
$factory =array(AbstractAdapter::class,'createSystemCache');
30+
$annotationsPool =$container->findDefinition('cache.annotations');
31+
if ($factory !==$annotationsPool->getFactory() ||4 !==count($annotationsPool->getArguments())) {
32+
return;
33+
}
34+
if ($container->has('monolog.logger.cache')) {
35+
$annotationsPool->addArgument(newReference('monolog.logger.cache'));
36+
}elseif ($container->hasDefinition('cache.system')) {
37+
$systemPool =$container->getDefinition('cache.system');
38+
if ($factory ===$systemPool->getFactory() &&5 <=count($systemArgs =$systemPool->getArguments())) {
39+
$annotationsPool->addArgument($systemArgs[4]);
40+
}
41+
}
42+
}
43+
}

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php‎

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

1212
namespaceSymfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14-
useSymfony\Component\Cache\Adapter\AbstractAdapter;
1514
useSymfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1615
useSymfony\Component\DependencyInjection\ContainerBuilder;
1716
useSymfony\Component\DependencyInjection\Reference;
@@ -39,22 +38,5 @@ public function process(ContainerBuilder $container)
3938
}
4039
}
4140
}
42-
43-
if (!$container->has('cache.annotations')) {
44-
return;
45-
}
46-
$factory =array(AbstractAdapter::class,'createSystemCache');
47-
$annotationsPool =$container->getDefinition('cache.annotations');
48-
if ($factory !==$annotationsPool->getFactory() ||4 !==count($annotationsPool->getArguments())) {
49-
return;
50-
}
51-
if ($container->has('monolog.logger.cache')) {
52-
$annotationsPool->addArgument(newReference('monolog.logger.cache'));
53-
}elseif ($container->has('cache.system')) {
54-
$systemPool =$container->getDefinition('cache.system');
55-
if ($factory ===$systemPool->getFactory() &&5 <=count($systemArgs =$systemPool->getArguments())) {
56-
$annotationsPool->addArgument($systemArgs[4]);
57-
}
58-
}
5941
}
6042
}

‎src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
useSymfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddDebugLogProcessorPass;
1616
useSymfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddValidatorInitializersPass;
1717
useSymfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass;
18+
useSymfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CacheAnnotationsMonologInjectorPass;
1819
useSymfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPass;
1920
useSymfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolClearerPass;
2021
useSymfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ControllerArgumentValueResolverPass;
@@ -96,6 +97,7 @@ public function build(ContainerBuilder $container)
9697
$container->addCompilerPass(newCachePoolPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION,32);
9798
$container->addCompilerPass(newValidateWorkflowsPass());
9899
$container->addCompilerPass(newCachePoolClearerPass(), PassConfig::TYPE_AFTER_REMOVING);
100+
$container->addCompilerPass(newCacheAnnotationsMonologInjectorPass(), PassConfig::TYPE_BEFORE_REMOVING,32);
99101

100102
if ($container->getParameter('kernel.debug')) {
101103
$container->addCompilerPass(newAddDebugLogProcessorPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -32);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp