Symfony Change Confirmation Message Globally

Is there a way to change the basic validation error message to one that I need for all objects at the same time? Currently, Yaml is used for each object, but this is not the way.

CF\MyBundle\Entity\User:
   properties:
    email:
      - Email:
          message: e-mail no válido
      - NotBlank:
          message: Campo obligatorio
    username:
      -NotBlank:
          message: Campo obligatorio

      

+3


source to share


1 answer


The easiest way is to define a translation file.



# app/Resources/translations/validators.es.yml
This value should not be blank.: Campo obligatorio
This value is not a valid email address.: e-mail no válido

      

+2


source







All Articles