Bridge/Symfony/Validator/Constraints/SaleItemAvailabilityValidator.php
private function validateItem(SaleItemInterface $item)
    {
        foreach ($item->getChildren() as $child) {
            $this->validateItem($child);
        }

        if ($item->isCompound()) {
            return;
        }

        if (null === $subject = $this->subjectHelper->resolve($item, false)) {
            return;
        }

        if (!$subject instanceof StockSubjectInterface) {
            return;
        }

        $quantity = $item->getTotalQuantity();
        $availability = $this->availabilityHelper->getAvailability($subject, is_null($item->getParent()));

        if ($quantity < $availability->getMinimumQuantity()) {
            $message = $availability->getMinimumMessage();
        } elseif ($quantity > $availability->getMaximumQuantity()) {
            $message = $availability->getMaximumMessage();
        } else {
            return;
        }

        if (null !== $item->getParent()) {
            $message = $item->getDesignation() . ' : ' . $message;
        }

        throw new ValidationFailedException($message);
    }
private function validateItem(SaleItemInterface $item)
    {
        foreach ($item->getChildren() as $child) {
            $this->validateItem($child);
        }

        if ($item->isCompound()) {
            return;
        }

        if (null === $subject = $this->subjectHelper->resolve($item, false)) {
            return;
        }

        if (!$subject instanceof StockSubjectInterface) {
            return;
        }

        $quantity = $item->getTotalQuantity();
        $availability = $this->availabilityHelper->getAvailability($subject, is_null($item->getParent()));

        if ($quantity < $availability->getMinimumQuantity()) {
            $message = $availability->getMinimumMessage();
        } elseif ($quantity > $availability->getMaximumQuantity()) {
            $message = $availability->getMaximumMessage();
        } else {
            return;
        }

        if (null !== $item->getParent()) {
            $message = $item->getDesignation() . ' : ' . $message;
        }

        throw new ValidationFailedException($message);
    }
Validates the sale item recursively.

@param SaleItemInterface $item

@throws ValidationFailedException