-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
Hello, since the bundle doesn't automatically do this I created an extractor which should be able to get all the transactions from all the constraints:
In the following example the extracted string would be Inserisci la nuova password.
.
class ChangePasswordFormType extends AbstractType
{
/**
* @param mixed[] $options
* @param FormBuilderInterface<FormBuilderInterface|string> $builder
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('plainPassword', RepeatedType::class, [
'type' => PasswordType::class,
'first_options' => [
'constraints' => [
new NotBlank([
'message' => 'Inserisci la nuova password.',
]),
new Length([
'min' => 6,
'minMessage' => 'La nuova password deve essere di almeno {{ limit }} caratteri.',
// max length allowed by Symfony for security reasons
'max' => 4096,
]),
],
'label' => 'Nuova password',
],
'second_options' => [
'label' => 'Ripeti password',
],
'invalid_message' => 'Le due password devono corrispondere.',
// Instead of being set onto the object directly,
// this is read and encoded in the controller
'mapped' => false,
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([]);
}
}
Metadata
Metadata
Assignees
Labels
No labels