I'm setting up a form through annotations using
/**
* @ORM\Column(type="boolean", nullable=false, name="is_public")
* @Annotation\Required(false)
* @Annotation\AllowEmpty()
* @Annotation\Attributes({"placeholder":"Is Public"})
* @Annotation\Filter({"name":"boolean"})
* @Annotation\Options({"label":"Is Public"})
*/
private $isPublic;
This form is built using the doctrine annotation builder and the doctrine entity hydrator. The entity is then bound to this form. There is an issue when passing a boolean field, in that any value is treated as false, except 1, passing 0 results in an error message of "cannot be empty".
Can somebody please advise as to how I can use boolean fields properly using this method? Ideally I'd like to be able to use the filter before the field is validated? Not only that, but the validation is ignoring the AllowEmpty() and Required(false) fields.
Kind Regards,
ise