-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed as not planned
Closed as not planned
Copy link
Description
Symfony version(s) affected
7.3
Description
When using a TranslatableMessage with an explicitly set domain in a Constraint/Length minMessage the passed domain is ignored and reset to 'validators'.
How to reproduce
class RegistrationFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
...
->add('plainPassword', PasswordType::class, [
// ...
'constraints' => [
// ...
new Length([
'min' => 8,
'minMessage' => new TranslatableMessage('registration.password.min', [], 'forms'),
'max' => 4096,
]),
],
])
;
}forms.en.yaml
registration:
password:
min: 'Your password should be at least {{ limit }} characters'WebProfiler shows, that Symfony is looking for 'registration.password.min' inside validators domain ignoring the set domain. If you put the same config in validators.en.yaml it works.
I use TranslatableMessage in other constraints aswell and there the passed domain is used.
Possible Solution
No response
Additional Context
No response