You are here

class PurchasedEntityAvailableConstraint in Commerce Core 8.2

Purchasable entity available reference constraint.

Plugin annotation


@Constraint(
  id = "PurchasedEntityAvailable",
  label = @Translation("Purchasable entity available", context = "Validation")
)

Hierarchy

Expanded class hierarchy of PurchasedEntityAvailableConstraint

File

modules/order/src/Plugin/Validation/Constraint/PurchasedEntityAvailableConstraint.php, line 15

Namespace

Drupal\commerce_order\Plugin\Validation\Constraint
View source
class PurchasedEntityAvailableConstraint extends Constraint {

  /**
   * The default violation message.
   *
   * @var string
   */
  public $message = '%label is not available with a quantity of %quantity.';

  /**
   * {@inheritdoc}
   *
   * This is overridden to make extending the constraint plugin easier. It
   * simplifies the ability to customize the $message property without having
   * to override this method and define the constraint validator.
   */
  public function validatedBy() {
    return PurchasedEntityAvailableConstraintValidator::class;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PurchasedEntityAvailableConstraint::$message public property The default violation message.
PurchasedEntityAvailableConstraint::validatedBy public function This is overridden to make extending the constraint plugin easier. It simplifies the ability to customize the $message property without having to override this method and define the constraint validator.