From 907bbece010920906044a362c76c47c4e05618d6 Mon Sep 17 00:00:00 2001 From: ogizanagi Date: Thu, 3 Dec 2015 14:16:45 +0100 Subject: [PATCH] [FrameworkBundle][Validator] Fix apc cache service deprecation --- UPGRADE-2.8.md | 22 +++++++++++++++++++ UPGRADE-3.0.md | 21 ++++++++++++++++++ .../DependencyInjection/Configuration.php | 10 ++++++++- .../Resources/config/validator.xml | 2 +- .../DependencyInjection/Fixtures/php/full.php | 2 +- .../DependencyInjection/Fixtures/xml/full.xml | 2 +- .../DependencyInjection/Fixtures/yml/full.yml | 2 +- .../FrameworkExtensionTest.php | 2 +- 8 files changed, 57 insertions(+), 6 deletions(-) diff --git a/UPGRADE-2.8.md b/UPGRADE-2.8.md index 1166e6ad56..846532b2fd 100644 --- a/UPGRADE-2.8.md +++ b/UPGRADE-2.8.md @@ -453,6 +453,28 @@ FrameworkBundle cookie_httponly: false ``` + * The `validator.mapping.cache.apc` service is deprecated, and will be removed in 3.0. + Use `validator.mapping.cache.doctrine.apc` instead. + + * The ability to pass `apc` as the `framework.validation.cache` configuration key value is deprecated, + and will be removed in 3.0. Use `validator.mapping.cache.doctrine.apc` instead: + + Before: + + ```yaml + framework: + validation: + cache: apc + ``` + + After: + + ```yaml + framework: + validation: + cache: validator.mapping.cache.doctrine.apc + ``` + Security -------- diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 7acdcddfe9..15347075c8 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -481,6 +481,27 @@ UPGRADE FROM 2.x to 3.0 interface. The `security.csrf.token_manager` should be used instead. + * The `validator.mapping.cache.apc` service has been removed in favor of the `validator.mapping.cache.doctrine.apc` one. + + * The ability to pass `apc` as the `framework.validation.cache` configuration key value has been removed. + Use `validator.mapping.cache.doctrine.apc` instead: + + Before: + + ```yaml + framework: + validation: + cache: apc + ``` + + After: + + ```yaml + framework: + validation: + cache: validator.mapping.cache.doctrine.apc + ``` + ### HttpKernel * The `Symfony\Component\HttpKernel\Log\LoggerInterface` has been removed in diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 309cc6c48c..b351039da9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -645,7 +645,15 @@ class Configuration implements ConfigurationInterface ->scalarNode('cache') ->beforeNormalization() // Can be removed in 3.0, once ApcCache support is dropped - ->ifString()->then(function ($v) { return 'apc' === $v ? 'validator.mapping.cache.apc' : $v; }) + ->ifString()->then(function ($v) { + if ('apc' === $v) { + @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); + + return 'validator.mapping.cache.apc'; + } + + return $v; + }) ->end() ->end() ->booleanNode('enable_annotations')->defaultFalse()->end() diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml index de8709ffd1..a18099f973 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml @@ -37,6 +37,7 @@ %validator.mapping.cache.prefix% + The "%service_id%" service is deprecated since Symfony 2.5 and will be removed in 3.0. @@ -47,7 +48,6 @@ - The "%service_id%" service is deprecated since Symfony 2.8 and will be removed in 3.0. diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php index 7c135dfc35..b3e32a5eb5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php @@ -55,7 +55,7 @@ $container->loadFromExtension('framework', array( ), 'validation' => array( 'enabled' => true, - 'cache' => 'apc', + 'cache' => 'validator.mapping.cache.doctrine.apc', ), 'annotations' => array( 'cache' => 'file', diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml index b94f44762f..c0ebb67ea1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml @@ -37,7 +37,7 @@ %kernel.root_dir%/Fixtures/translations - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml index 13ceca12a4..b2693d7e02 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml @@ -43,7 +43,7 @@ framework: paths: ['%kernel.root_dir%/Fixtures/translations'] validation: enabled: true - cache: apc + cache: validator.mapping.cache.doctrine.apc annotations: cache: file debug: true diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 188f421387..88141caaf0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -293,7 +293,7 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertSame('addMethodMapping', $calls[4][0]); $this->assertSame(array('loadValidatorMetadata'), $calls[4][1]); $this->assertSame('setMetadataCache', $calls[5][0]); - $this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]); + $this->assertEquals(array(new Reference('validator.mapping.cache.doctrine.apc')), $calls[5][1]); } /**