public function validate($value, Constraint $constraint)
{
if (!$value instanceof ProductVariantInterface) {
throw new UnexpectedTypeException($value, ProductVariantInterface::class);
}
$product = $value->getProduct();
if (!$product->hasVariants() || !$product->hasOptions()) {
return;
}
if ($this->variantsParityChecker->checkParity($value, $product)) {
$this->context->addViolation($constraint->message);
}
}