10000 [FrameworkBundle][Validator] Fix apc cache service deprecation · symfony/symfony@907bbec · GitHub
[go: up one dir, main page]

Skip to content

Commit 907bbec

Browse files
committed
[FrameworkBundle][Validator] Fix apc cache service deprecation
1 parent dd78303 commit 907bbec

File tree

8 files changed

+57
-6
lines changed

8 files changed

+57
-6
lines changed

UPGRADE-2.8.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,28 @@ FrameworkBundle
453453
cookie_httponly: false
454454
```
455455
456+
* The `validator.mapping.cache.apc` service is deprecated, and will be removed in 3.0.
457+
Use `validator.mapping.cache.doctrine.apc` instead.
458+
459+
* The ability to pass `apc` as the `framework.validation.cache` configuration key value is deprecated,
460+
and will be removed in 3.0. Use `validator.mapping.cache.doctrine.apc` instead:
461+
462+
Before:
463+
464+
```yaml
465+
framework:
466+
validation:
467+
cache: apc
468+
```
469+
470+
After:
471+
472+
```yaml
473+
framework:
474+
validation:
475+
cache: validator.mapping.cache.doctrine.apc
476+
```
477+
456478
Security
457479
--------
458480

UPGRADE-3.0.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,27 @@ UPGRADE FROM 2.x to 3.0
481481
interface.
482482
The `security.csrf.token_manager` should be used instead.
483483

484+
* The `validator.mapping.cache.apc` service has been removed in favor of the `validator.mapping.cache.doctrine.apc` one.
485+
486+
* The ability to pass `apc` as the `framework.validation.cache` configuration key value has been removed.
487+
Use `validator.mapping.cache.doctrine.apc` instead:
488+
489+
Before:
490+
491+
```yaml
492+
framework:
493+
validation:
494+
cache: apc
495+
```
496+
497+
After:
498+
499+
```yaml
500+
framework:
501+
validation:
502+
cache: validator.mapping.cache.doctrine.apc
503+
```
504+
484505
### HttpKernel
485506

486507
* The `Symfony\Component\HttpKernel\Log\LoggerInterface` has been removed in

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,15 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
645645
->scalarNode('cache')
646646
->beforeNormalization()
647647
// Can be removed in 3.0, once ApcCache support is dropped
648-
->ifString()->then(function ($v) { return 'apc' === $v ? 'validator.mapping.cache.apc' : $v; })
648+
->ifString()->then(function ($v) {
649+
if ('apc' === $v) {
650+
@trigger_error('The ability to pass "apc" as the framework.validation.cache configuration key value is deprecated since version 2.8 and will be removed in 3.0. Use the "validator.mapping.cache.doctrine.apc" service id instead.', E_USER_DEPRECATED);
651+
652+
return 'validator.mapping.cache.apc';
653+
}
654+
655+
return $v;
656+
})
649657
->end()
650658
->end()
651659
->booleanNode('enable_annotations')->defaultFalse()->end()

src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
<service id="validator.mapping.cache.apc" class="%validator.mapping.cache.apc.class%" public="false">
3939
<argument>%validator.mapping.cache.prefix%</argument>
40+
<deprecated>The "%service_id%" service is deprecated since Symfony 2.5 and will be removed in 3.0.</deprecated>
4041
</service>
4142

4243
<service id="validator.mapping.cache.doctrine.apc" class="Symfony\Component\Validator\Mapping\Cache\DoctrineCache" public="false">
@@ -47,7 +48,6 @@
4748
</call>
4849
</service>
4950
</argument>
50-
<deprecated>The "%service_id%" service is deprecated since Symfony 2.8 and will be removed in 3.0.</deprecated>
5151
</service>
5252

5353
<service id="validator.validator_factory" class="%validator.validator_factory.class%" public="false">

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
),
5656
'validation' => array(
5757
'enabled' => true,
58-
'cache' => 'apc',
58+
'cache' => 'validator.mapping.cache.doctrine.apc',
5959
),
6060
'annotations' => array(
6161
'cache' => 'file',

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<framework:translator enabled="true" fallback="fr" logging="true">
3838
<framework:path>%kernel.root_dir%/Fixtures/translations</framework:path>
3939
</framework:translator>
40-
<framework:validation enabled="true" cache="apc" />
40+
<framework:validation enabled="true" cache="validator.mapping.cache.doctrine.apc" />
4141
<framework:annotations cache="file" debug="true" file-cache-dir="%kernel.cache_dir%/annotations" />
4242
<framework:serializer enabled="true" enable-annotations="true" cache="serializer.mapping.cache.apc" name-converter="serializer.name_converter.camel_case_to_snake_case" />
4343
</framework:config>

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ framework:
4343
paths: ['%kernel.root_dir%/Fixtures/translations']
4444
validation:
4545
enabled: true
46-
cache: apc
46+
cache: validator.mapping.cache.doctrine.apc
4747
annotations:
4848
cache: file
4949
debug: true

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public function testValidation()
293293
$this->assertSame('addMethodMapping', $calls[4][0]);
294294
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
295295
$this->assertSame('setMetadataCache', $calls[5][0]);
296-
$this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]);
296+
$this->assertEquals(array(new Reference('validator.mapping.cache.doctrine.apc')), $calls[5][1]);
297297
}
298298

299299
/**

0 commit comments

Comments
 (0)
0