0
votes

I'm using symfony 2.7 version. i try to do validate, and it's works fine, just the message for the validate not working. for exmple, email validate:

 /**
 * @Assert\NotBlank()
 *      message = "Email empty";
 * )
 */
/**
 * @ORM\Column(type="string", length=100)
 */
protected $email;

i'm still get the default message: "This value should not be blank." i recreate the Entity file, and Run

php app/console doctrine:generate:entities AppBundle:User

and still the default message. i turn validation: { enable_annotations: true } no any changes. i see the errors, by :

var_dump($errors);

so custuom message not work at all.

thanks

1

1 Answers

1
votes

the message option must be written between the parentheses:

/**
 * @Assert\NotBlank(
 *      message = "Email empty";
 * )
 * @ORM\Column(type="string", length=100)
 */
protected $email;