Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I add assert validation on boolean doctrine field?

I have a Doctrine entity that has boolean field. Should I add Symfony validation for it (for type boolean), or my form is correctly validated by inferring the type automatically?

class Entity
{
    /**
     * @ORM\Column(type="boolean")
     * @Assert\.... <- do I have to apply any Symfony assertion here?
     */
    private $isActive;
}
like image 326
TautrimasPajarskas Avatar asked Aug 14 '13 10:08

TautrimasPajarskas


1 Answers

No, you have only two cases. Value is present or not - so true or false. I imagine a validator only in one case if this checkbox has to be set by user always like "accept disclaimer" during registration process

like image 54
Lazy Ants Avatar answered Nov 03 '22 07:11

Lazy Ants