getObject(); $class = isset($payload['doctrine']) ? DoctrineEvents::class : WorkFlowEvents::class; if (!empty(array_intersect($entity->getEvent(), $class::getChoices())) && is_null($value)) { $context->buildViolation('error.event_field_required') ->addViolation() ; } } }