I have field birthday:
/**
* @ORM\Column(type="date", nullable=true)
*/
protected $birthday;
and Form:
->add('birthday', null, array('widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
How can I change message for this if value is not correctly?
I try in Entity:
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('birthday', new Assert\Date(array('message' => 'test')));
}
But this validator is not used... So where is validator for this?
Seems like a
DateValidator::validate
issue:The method contains the following check before doing any validation:
The $value parameter is of type \DateTime event when using the
single_text
option.A possible workaround would be to change the error message at the form level:
Hope this helps.