Skip to content

Commit 56807db

Browse files
alexandre-dauboisfabpot
authored andcommitted
[FrameworkBundle][Validator] Add framework.validation.disable_translation config
1 parent bc6d661 commit 56807db

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ CHANGELOG
1010
* Add new `framework.property_info.with_constructor_extractor` option to allow enabling or disabling the constructor extractor integration
1111
* Deprecate the `--show-arguments` option of the `container:debug` command, as arguments are now always shown
1212
* Add `RateLimiterFactoryInterface` as an alias of the `limiter` service
13+
* Add `framework.validation.disable_translation` option
1314

1415
7.2
1516
---

DependencyInjection/Configuration.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,9 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e
10621062
->end()
10631063
->end()
10641064
->end()
1065+
->booleanNode('disable_translation')
1066+
->defaultFalse()
1067+
->end()
10651068
->arrayNode('auto_mapping')
10661069
->info('A collection of namespaces for which auto-mapping will be enabled by default, or null to opt-in with the EnableAutoMapping constraint.')
10671070
->example([

DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,10 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
17241724
$validatorBuilder->addMethodCall('setMappingCache', [new Reference('validator.mapping.cache.adapter')]);
17251725
}
17261726

1727+
if ($config['disable_translation'] ?? false) {
1728+
$validatorBuilder->addMethodCall('disableTranslation');
1729+
}
1730+
17271731
$container->setParameter('validator.auto_mapping', $config['auto_mapping']);
17281732
if (!$propertyInfoEnabled || !class_exists(PropertyInfoLoader::class)) {
17291733
$container->removeDefinition('validator.property_info_loader');

Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@
298298
<xsd:attribute name="enable-attributes" type="xsd:boolean" />
299299
<xsd:attribute name="static-method" type="xsd:boolean" />
300300
<xsd:attribute name="translation-domain" type="xsd:string" />
301+
<xsd:attribute name="disable-translation" type="xsd:boolean" />
301302
<xsd:attribute name="strict-email" type="xsd:boolean" />
302303
<xsd:attribute name="email-validation-mode" type="email-validation-mode" />
303304
</xsd:complexType>

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ protected static function getBundleDefaultConfig()
775775
'enable_attributes' => !class_exists(FullStack::class),
776776
'static_method' => ['loadValidatorMetadata'],
777777
'translation_domain' => 'validators',
778+
'disable_translation' => false,
778779
'mapping' => [
779780
'paths' => [],
780781
],

0 commit comments

Comments
 (0)