/** * Checks if the passed value is valid. * * @param NodeInterface $value The value that should be validated * @param Constraint $constraint The constraint for the validation * * @api */ public function validate($value, Constraint $constraint) { $result = $this->repository->hasOtherNodeWithSameParentAndOrder($value->getParentId(), $value->getOrder(), $value->getNodeId(), $value->getSiteId()); if (true === $result) { $this->context->buildViolation($constraint->message)->addViolation(); } }