/** * {@inheritDoc} */ public function validate($value, Constraint $constraint) { $callback = $constraint->getFilterCallback(); $entity = $constraint->getMapper()->findBy($callback($value)); if ($entity instanceof AbstractEntity) { return; } $this->context->addViolation($constraint->message, ['{{ field }}' => $constraint->field, '{{ value }}' => $value], $value); }