ModelBundle/Validator/Constraints/UniqueSiteIdValidator.php
public function validate($value, Constraint $constraint)
    {
        $result = $this->repository->findOneBySiteId($value->getSiteId());

        if (null !== $result && $result->getId() !== $value->getId()) {
            $this->context->buildViolation($constraint->message)
                ->atPath('siteId')
                ->addViolation();
        }
    }
public function validate($value, Constraint $constraint)
    {
        $result = $this->repository->findOneBySiteId($value->getSiteId());

        if (null !== $result && $result->getId() !== $value->getId()) {
            $this->context->buildViolation($constraint->message)
                ->atPath('siteId')
                ->addViolation();
        }
    }
Checks if the passed value is valid.

@param SiteInterface              $value      The value that should be validated
@param UniqueMainAlias|Constraint $constraint The constraint for the validation

@api