Skip to content

Commit 32267a1

Browse files
committed
Form config + tests + changelog
1 parent 97249de commit 32267a1

File tree

7 files changed

+15
-6
lines changed

7 files changed

+15
-6
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ private function registerFormConfiguration(array $config, ContainerBuilder $cont
521521
{
522522
$loader->load('form.php');
523523

524-
$container->getDefinition('form.type_extension.form.validator')->setArgument(1, $config['form']['legacy_error_messages']);
524+
$container->getDefinition('form.type_extension.form.validator')->setArgument(3, $config['form']['legacy_error_messages']);
525525

526526
if (null === $config['form']['csrf_protection']['enabled']) {
527527
$config['form']['csrf_protection']['enabled'] = $config['csrf_protection']['enabled'];

src/Symfony/Bundle/FrameworkBundle/Resources/config/form.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@
125125
->args([service('request_stack')])
126126

127127
->set('form.type_extension.form.validator', FormTypeValidatorExtension::class)
128-
->args([service('validator')])
128+
->args([
129+
service('validator'),
130+
service('twig.form.renderer')->ignoreOnInvalid(),
131+
service('translator')->ignoreOnInvalid(),
132+
])
129133
->tag('form.type_extension', ['extended-type' => FormType::class])
130134

131135
->set('form.type_extension.repeated.validator', RepeatedTypeValidatorExtension::class)

src/Symfony/Component/Form/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
5.2.0
5+
-----
6+
7+
* Added support for using the `{{ label }}` placeholder in constraint messages, which is replaced in the `ViolationMapper` by the corresponding field form label.
8+
49
5.1.0
510
-----
611

src/Symfony/Component/Form/Test/Traits/ValidatorExtensionTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ protected function getValidatorExtension(): ValidatorExtension
3939
$this->validator->expects($this->any())->method('getMetadataFor')->will($this->returnValue($metadata));
4040
$this->validator->expects($this->any())->method('validate')->will($this->returnValue(new ConstraintViolationList()));
4141

42-
return new ValidatorExtension($this->validator, false);
42+
return new ValidatorExtension($this->validator, null, null, false);
4343
}
4444
}

src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorPerformanceTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class FormValidatorPerformanceTest extends FormPerformanceTestCase
2323
protected function getExtensions()
2424
{
2525
return [
26-
new ValidatorExtension(Validation::createValidator(), false),
26+
new ValidatorExtension(Validation::createValidator(), null, null, false),
2727
];
2828
}
2929

src/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testValidConstraint()
6464
public function testGroupSequenceWithConstraintsOption()
6565
{
6666
$form = Forms::createFormFactoryBuilder()
67-
->addExtension(new ValidatorExtension(Validation::createValidator(), false))
67+
->addExtension(new ValidatorExtension(Validation::createValidator(), null, null, false))
6868
->getFormFactory()
6969
->create(FormTypeTest::TESTED_TYPE, null, (['validation_groups' => new GroupSequence(['First', 'Second'])]))
7070
->add('field', TextTypeTest::TESTED_TYPE, [

src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorExtensionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function test2Dot5ValidationApi()
3535
->setMetadataFactory($metadataFactory)
3636
->getValidator();
3737

38-
$extension = new ValidatorExtension($validator, false);
38+
$extension = new ValidatorExtension($validator, null, null, false);
3939

4040
$this->assertInstanceOf(ValidatorTypeGuesser::class, $extension->loadTypeGuesser());
4141

0 commit comments

Comments
 (0)