/** * {@inheritDoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('value', TextType::class, ['constraints' => [new Callback(function ($value, ExecutionContextInterface $context) { if (!preg_match("/^" . $this->config->getFormat('phone') . "\$/u", $value)) { $context->buildViolation($this->translator->trans('phone_number_has_not_valid_format'))->addViolation(); } })], 'invalid_message' => $this->translator->trans('phone_number_has_not_valid_format')]); }
/** * {@inheritDoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('value', PasswordType::class, ['constraints' => [new Length(['min' => (int) $this->config->getFormat('passwordLength'), 'minMessage' => $this->translator->trans('password_is_too_short')]), new NotBlank()], 'invalid_message' => $this->translator->trans('password_is_too_short')]); }
/** * {@inheritDoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('value', RepeatedType::class, ['first_name' => 'password', 'second_name' => 'confirm', 'constraints' => [new Length(['min' => (int) $this->config->getFormat('passwordLength'), 'minMessage' => $this->translator->trans('password_is_too_short')]), new NotBlank()], 'invalid_message' => $this->translator->trans('passwords_are_different')]); }