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

Appearance settings

Commit 41fd5d1

Browse filesBrowse files
committed
feature #21375 [FrameworkBundle][Config] Move ConfigCachePass from FrameworkBundle to Config (Deamon)
This PR was merged into the 3.3-dev branch. Discussion ---------- [FrameworkBundle][Config] Move ConfigCachePass from FrameworkBundle to Config | Q | A | ------------- | --- | Branch? | master<!--see comment below--> | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes/no | Fixed tickets | - <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | <!--highly recommended for new features--> This MR is part of the #21284 todo list <!-- - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch. - Please fill in this template according to the PR you're about to submit. - Replace this comment by a description of what your PR is solving. --> Commits ------- bce445f Move ConfigCachePass from FrameworkBundle to Config
2 parents 3729a15 + bce445f commit 41fd5d1
Copy full SHA for 41fd5d1

File tree

10 files changed

+137
-19
lines changed
Filter options

10 files changed

+137
-19
lines changed

‎UPGRADE-3.3.md

Copy file name to clipboardExpand all lines: UPGRADE-3.3.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ FrameworkBundle
7979
deprecated and will be removed in 4.0. Use the `Symfony\Component\HttpKernel\EventListener\TestSessionListener`
8080
class instead.
8181

82+
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ConfigCachePass` class has been
83+
deprecated and will be removed in 4.0. Use `Symfony\Component\Config\DependencyInjection\ConfigCachePass`
84+
class instead.
85+
86+
8287
HttpKernel
8388
-----------
8489

‎UPGRADE-4.0.md

Copy file name to clipboardExpand all lines: UPGRADE-4.0.md
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ FrameworkBundle
195195
removed. Use the `Symfony\Component\HttpKernel\EventListener\TestSessionListener`
196196
class instead.
197197

198+
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ConfigCachePass` class has been removed.
199+
Use `Symfony\Component\Config\DependencyInjection\ConfigCachePass` class instead.
200+
201+
198202
HttpFoundation
199203
---------------
200204

‎src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ CHANGELOG
1717
* Deprecated `FormPass`, use `Symfony\Component\Form\DependencyInjection\FormPass` instead
1818
* Deprecated `SessionListener`
1919
* Deprecated `TestSessionListener`
20+
* Deprecated `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ConfigCachePass`.
21+
Use `Symfony\Component\Console\DependencyInjection\ConfigCachePass` instead.
2022

2123
3.2.0
2224
-----

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ConfigCachePass.php
+6-16Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,18 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14-
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15-
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
16-
use Symfony\Component\DependencyInjection\ContainerBuilder;
14+
use Symfony\Component\Config\DependencyInjection\ConfigCachePass as BaseConfigCachePass;
15+
16+
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use Symfony\Component\Config\DependencyInjection\ConfigCachePass instead.', ConfigCachePass::class), E_USER_DEPRECATED);
1717

1818
/**
1919
* Adds services tagged config_cache.resource_checker to the config_cache_factory service, ordering them by priority.
2020
*
21+
* @deprecated since version 3.3, to be removed in 4.0. Use {@link BaseConfigCachePass} instead.
22+
*
2123
* @author Matthias Pigulla <mp@webfactory.de>
2224
* @author Benjamin Klotz <bk@webfactory.de>
2325
*/
24-
class ConfigCachePass implements CompilerPassInterface
26+
class ConfigCachePass extends BaseConfigCachePass
2527
{
26-
use PriorityTaggedServiceTrait;
27-
28-
public function process(ContainerBuilder $container)
29-
{
30-
$resourceCheckers = $this->findAndSortTaggedServices('config_cache.resource_checker', $container);
31-
32-
if (empty($resourceCheckers)) {
33-
return;
34-
}
35-
36-
$container->getDefinition('config_cache_factory')->replaceArgument(0, $resourceCheckers);
37-
}
3828
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationExtractorPass;
3535
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationDumperPass;
3636
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\UnusedTagsPass;
37-
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ConfigCachePass;
3837
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ValidateWorkflowsPass;
38+
use Symfony\Component\Config\DependencyInjection\ConfigCachePass;
3939
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass;
4040
use Symfony\Component\Serializer\DependencyInjection\SerializerPass;
4141
use Symfony\Component\Debug\ErrorHandler;
@@ -108,7 +108,7 @@ public function build(ContainerBuilder $container)
108108
$container->addCompilerPass(new UnusedTagsPass(), PassConfig::TYPE_AFTER_REMOVING);
109109
$container->addCompilerPass(new ContainerBuilderDebugDumpPass(), PassConfig::TYPE_AFTER_REMOVING);
110110
$container->addCompilerPass(new CompilerDebugDumpPass(), PassConfig::TYPE_AFTER_REMOVING, -32);
111-
$container->addCompilerPass(new ConfigCachePass());
111+
$this->addCompilerPassIfExists($container, ConfigCachePass::class);
112112
$container->addCompilerPass(new CacheCollectorPass());
113113
}
114114
}

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ConfigCachePassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ConfigCachePassTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
use Symfony\Component\DependencyInjection\Reference;
1616
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ConfigCachePass;
1717

18+
/**
19+
* @group legacy
20+
*/
1821
class ConfigCachePassTest extends TestCase
1922
{
2023
public function testThatCheckersAreProcessedInPriorityOrder()

‎src/Symfony/Component/Config/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* added `ReflectionClassResource` class
88
* added second `$exists` constructor argument to `ClassExistenceResource`
99
* made `ClassExistenceResource` work with interfaces and traits
10+
* added `ConfigCachePass` (originally in FrameworkBundle)
1011

1112
3.0.0
1213
-----
+47Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
namespace Symfony\Component\Config\DependencyInjection;
13+
14+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15+
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
16+
use Symfony\Component\DependencyInjection\ContainerBuilder;
17+
18+
/**
19+
* Adds services tagged config_cache.resource_checker to the config_cache_factory service, ordering them by priority.
20+
*
21+
* @author Matthias Pigulla <mp@webfactory.de>
22+
* @author Benjamin Klotz <bk@webfactory.de>
23+
*/
24+
class ConfigCachePass implements CompilerPassInterface
25+
{
26+
use PriorityTaggedServiceTrait;
27+
28+
private $factoryServiceId;
29+
private $resourceCheckerTag;
30+
31+
public function __construct($factoryServiceId = 'config_cache_factory', $resourceCheckerTag = 'config_cache.resource_checker')
32+
{
33+
$this->factoryServiceId = $factoryServiceId;
34+
$this->resourceCheckerTag = $resourceCheckerTag;
35+
}
36+
37+
public function process(ContainerBuilder $container)
38+
{
39+
$resourceCheckers = $this->findAndSortTaggedServices($this->resourceCheckerTag, $container);
40+
41+
if (empty($resourceCheckers)) {
42+
return;
43+
}
44+
45+
$container->getDefinition($this->factoryServiceId)->replaceArgument(0, $resourceCheckers);
46+
}
47+
}
+62Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
namespace Symfony\Component\Config\Tests\DependencyInjection;
13+
14+
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\DependencyInjection\Reference;
16+
use Symfony\Component\Config\DependencyInjection\ConfigCachePass;
17+
18+
class ConfigCachePassTest extends TestCase
19+
{
20+
public function testThatCheckersAreProcessedInPriorityOrder()
21+
{
22+
$services = array(
23+
'checker_2' => array(0 => array('priority' => 100)),
24+
'checker_1' => array(0 => array('priority' => 200)),
25+
'checker_3' => array(0 => array()),
26+
);
27+
28+
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
29+
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds', 'getDefinition', 'hasDefinition'))->getMock();
30+
31+
$container->expects($this->atLeastOnce())
32+
->method('findTaggedServiceIds')
33+
->will($this->returnValue($services));
34+
$container->expects($this->atLeastOnce())
35+
->method('getDefinition')
36+
->with('config_cache_factory')
37+
->will($this->returnValue($definition));
38+
39+
$definition->expects($this->once())
40+
->method('replaceArgument')
41+
->with(0, array(
42+
new Reference('checker_1'),
43+
new Reference('checker_2'),
44+
new Reference('checker_3'),
45+
));
46+
47+
$pass = new ConfigCachePass();
48+
$pass->process($container);
49+
}
50+
51+
public function testThatCheckersCanBeMissing()
52+
{
53+
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds'))->getMock();
54+
55+
$container->expects($this->atLeastOnce())
56+
->method('findTaggedServiceIds')
57+
->will($this->returnValue(array()));
58+
59+
$pass = new ConfigCachePass();
60+
$pass->process($container);
61+
}
62+
}

‎src/Symfony/Component/Config/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/composer.json
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
"symfony/filesystem": "~2.8|~3.0"
2121
},
2222
"require-dev": {
23-
"symfony/yaml": "~3.0"
23+
"symfony/yaml": "~3.0",
24+
"symfony/dependency-injection": "~3.2"
25+
},
26+
"conflict": {
27+
"symfony/dependency-injection": "<3.2"
2428
},
2529
"suggest": {
2630
"symfony/yaml": "To use the yaml reference dumper"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.