From b57895ccafe8a6de72846f9e1ce0e524964405e7 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 10 Jun 2017 17:54:55 -0700 Subject: [PATCH 1/2] [FrameworkBundle] deprecated validator.mapping.cache.doctrine.apc --- UPGRADE-3.4.md | 2 ++ UPGRADE-4.0.md | 2 ++ .../DependencyInjection/Configuration.php | 13 ++++++++++++- .../FrameworkBundle/Resources/config/validator.xml | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md index e13d9b7febf6..34786d546470 100644 --- a/UPGRADE-3.4.md +++ b/UPGRADE-3.4.md @@ -16,6 +16,8 @@ Finder FrameworkBundle --------------- + * The `validator.mapping.cache.doctrine.apc` service has been deprecated. + * Using the `KERNEL_DIR` environment variable or the automatic guessing based on the `phpunit.xml` / `phpunit.xml.dist` file location is deprecated since 3.4. Set the `KERNEL_CLASS` environment variable to the fully-qualified class name diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index fce693437fdf..f6547fd0a040 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -227,6 +227,8 @@ Form FrameworkBundle --------------- + * The `validator.mapping.cache.doctrine.apc` service has been removed. + * The `cache:clear` command does not warmup the cache anymore. Warmup should be done via the `cache:warmup` command. diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 611bfad97db8..350d632741a3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -661,7 +661,18 @@ private function addValidationSection(ArrayNodeDefinition $rootNode) ->info('validation configuration') ->{!class_exists(FullStack::class) && class_exists(Validation::class) ? 'canBeDisabled' : 'canBeEnabled'}() ->children() - ->scalarNode('cache')->end() + ->scalarNode('cache') + ->beforeNormalization() + // Can be removed in 4.0, when validator.mapping.cache.apc is removed + ->ifString()->then(function ($v) { + if ('validator.mapping.cache.apc' === $v && !class_exists('Doctrine\Common\Cache\ApcCache')) { + throw new LogicException('Doctrine APC cache for the validator cannot be enabled as the Doctrine Cache package is not installed.'); + } + + return $v; + }) + ->end() + ->end() ->booleanNode('enable_annotations')->{!class_exists(FullStack::class) && class_exists(Annotation::class) ? 'defaultTrue' : 'defaultFalse'}()->end() ->arrayNode('static_method') ->defaultValue(array('loadValidatorMetadata')) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml index 5f505e859c82..aa472d380cb3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml @@ -57,6 +57,7 @@ + The "%service_id%" service is deprecated since Symfony 3.4 and will be removed in 4.0. Use a Psr6 cache like "validator.mapping.cache.symfony" instead. From a4e336ea3494a5acc9343d537254807df10ee3a6 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 10 Jun 2017 17:55:29 -0700 Subject: [PATCH 2/2] [FrameworkBundle] removed doctrine/cache as a dependency --- UPGRADE-3.4.md | 3 +++ src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md | 2 ++ .../FrameworkBundle/DependencyInjection/Configuration.php | 4 ++-- .../DependencyInjection/FrameworkExtension.php | 4 ++++ src/Symfony/Bundle/FrameworkBundle/composer.json | 4 ++-- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md index 34786d546470..d7d1b0059124 100644 --- a/UPGRADE-3.4.md +++ b/UPGRADE-3.4.md @@ -16,6 +16,9 @@ Finder FrameworkBundle --------------- + * The `doctrine/cache` dependency has been removed; require it via `composer + require doctrine/cache` if you are using Doctrine cache in your project. + * The `validator.mapping.cache.doctrine.apc` service has been deprecated. * Using the `KERNEL_DIR` environment variable or the automatic guessing based diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index f5aa2c8f04f9..458877a67c7a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -4,6 +4,8 @@ CHANGELOG 3.4.0 ----- +* Removed `doctrine/cache` from the list of required dependencies in `composer.json` +* Deprecated `validator.mapping.cache.doctrine.apc` service * Deprecated using the `KERNEL_DIR` environment variable with `KernelTestCase::getKernelClass()`. * Deprecated the `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` methods. diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 350d632741a3..3f9c4eee0242 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -663,9 +663,9 @@ private function addValidationSection(ArrayNodeDefinition $rootNode) ->children() ->scalarNode('cache') ->beforeNormalization() - // Can be removed in 4.0, when validator.mapping.cache.apc is removed + // Can be removed in 4.0, when validator.mapping.cache.doctrine.apc is removed ->ifString()->then(function ($v) { - if ('validator.mapping.cache.apc' === $v && !class_exists('Doctrine\Common\Cache\ApcCache')) { + if ('validator.mapping.cache.doctrine.apc' === $v && !class_exists('Doctrine\Common\Cache\ApcCache')) { throw new LogicException('Doctrine APC cache for the validator cannot be enabled as the Doctrine Cache package is not installed.'); } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index eb6ee7aeace8..e25318d39bf4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1220,6 +1220,10 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde $loader->load('annotations.xml'); if ('none' !== $config['cache']) { + if (!class_exists('Doctrine\Common\Cache\CacheProvider')) { + throw new LogicException('Annotations cannot be enabled as the Doctrine Cache library is not installed.'); + } + $cacheService = $config['cache']; if ('php_array' === $config['cache']) { diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 2b11a0d737d3..48cd6d9f7275 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -29,10 +29,10 @@ "symfony/filesystem": "~2.8|~3.0|~4.0", "symfony/finder": "~2.8|~3.0|~4.0", "symfony/routing": "~3.4|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0", - "doctrine/cache": "~1.0" + "symfony/stopwatch": "~2.8|~3.0|~4.0" }, "require-dev": { + "doctrine/cache": "~1.0", "fig/link-util": "^1.0", "symfony/asset": "~3.3|~4.0", "symfony/browser-kit": "~2.8|~3.0|~4.0",