In Symfony how do I make fields required based on a user's credential?

In Symfony I know how to display fields visible based on credential, but the problem is if the field is not visible to a user, but initially required, the form won't pass. How would I make it so if the field is not visible, it is not required?
Who is Participating?
sudhakarsp06Connect With a Mentor Commented:
Hi there,

Have you tried the below

$this->validatorSchema->setOption('allow_extra_fields', true);
All Courses

From novice to tech pro — start learning today.