You are here

class MinQtyLessThanOrEqualMaxQtyConstraint in Commerce Product Bundle 8

Helps validating that the minimum qty value is less than or equal to the maximum qty.

Plugin annotation


@Constraint(
  id = "MinQtyLessThanOrEqualMaxQty",
  label = @Translation("Checks that minimum quantity is less or equal than maximum quantity.", context = "Validation"),
  type = "entity:product_bundle_item"
)

Hierarchy

Expanded class hierarchy of MinQtyLessThanOrEqualMaxQtyConstraint

1 file declares its use of MinQtyLessThanOrEqualMaxQtyConstraint
MinQtyLessThanOrEqualMaxQtyConstraintValidatorTest.php in tests/src/Unit/Plugin/Validation/Constraint/MinQtyLessThanOrEqualMaxQtyConstraintValidatorTest.php

File

src/Plugin/Validation/Constraint/MinQtyLessThanOrEqualMaxQtyConstraint.php, line 16

Namespace

Drupal\commerce_product_bundle\Plugin\Validation\Constraint
View source
class MinQtyLessThanOrEqualMaxQtyConstraint extends CompositeConstraintBase {

  /**
   * Message that will be shown if validation fails.
   *
   * @var string
   */
  public $message = 'Minimum Quantity (%min) must be less than or equal to Maximum Quantity (%max).';

  /**
   * @inheritdoc
   */
  public function coversFields() {
    return [
      'min_quantity',
      'max_quantity',
    ];
  }

}

Members