Skip to content

Commit 7f002ea

Browse files
committed
[FrameworkBundle] deprecated validator.mapping.cache.doctrine.apc
1 parent c0afdbf commit 7f002ea

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

DependencyInjection/Configuration.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,18 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
661661
->info('validation configuration')
662662
->{!class_exists(FullStack::class) && class_exists(Validation::class) ? 'canBeDisabled' : 'canBeEnabled'}()
663663
->children()
664-
->scalarNode('cache')->end()
664+
->scalarNode('cache')
665+
->beforeNormalization()
666+
// Can be removed in 4.0, when validator.mapping.cache.apc is removed
667+
->ifString()->then(function ($v) {
668+
if ('validator.mapping.cache.apc' === $v && !class_exists('Doctrine\Common\Cache\ApcCache')) {
669+
throw new LogicException('Doctrine APC cache for the validator cannot be enabled as the Doctrine Cache package is not installed.');
670+
}
671+
672+
return $v;
673+
})
674+
->end()
675+
->end()
665676
->booleanNode('enable_annotations')->{!class_exists(FullStack::class) && class_exists(Annotation::class) ? 'defaultTrue' : 'defaultFalse'}()->end()
666677
->arrayNode('static_method')
667678
->defaultValue(array('loadValidatorMetadata'))

Resources/config/validator.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
</call>
5858
</service>
5959
</argument>
60+
<deprecated>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.</deprecated>
6061
</service>
6162

6263
<service id="validator.validator_factory" class="Symfony\Component\Validator\ContainerConstraintValidatorFactory">

0 commit comments

Comments
 (0)