I have defined foreign key in my User
entity:
/**
* @ORM\ManyToOne(targetEntity="Region")
*/
protected $region;
I'd like to use it in form as a choice field.
$builder->add('region');
Which works great in fact, until I want to validate if choice is valid entity id. In fact, that works great too, but I'm getting This value is not valid
error message and I need to override / translate it and I have no idea how. It's some kind of automatic validation. Logically, I'd say it should be overridable if I set @Assert\Choice...
, but even when I tried it with dummy values (message="You shall not pass", choices={1,2}
), it seemed to ignore it completely.