3

Is there a way to change the basic validation error message to one I need for all entities at once? Currently using Yaml config for every entity, but it's not a way.

CF\MyBundle\Entity\User:
  properties:
    email:
      - Email:
          message: e-mail no válido
      - NotBlank:
          message: Campo obligatorio
    username:
      - NotBlank:
          message: Campo obligatorio
greeflas
  • 825
  • 1
  • 8
  • 20
Vit Kos
  • 5,535
  • 5
  • 44
  • 58

1 Answers1

3

The easiest way is to define an translations 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
xdazz
  • 158,678
  • 38
  • 247
  • 274