Php – Constraint annotation to validate one field depending on another field
I have this entity class in Symfony/5.4: use DoctrineORMMapping as ORM; use SymfonyComponentValidatorConstraints as Assert; class Assignments { public const SALARY_RANGES = [ 'Red', 'Green', null, ]; /** * @ORMColumn(length=255, nullable=true) * @AssertChoice(choices=Assignments::SALARY_RANGES, strict=true) */ private ?string $salaryRange; /** *…