You are here

CurrencyConstraint.php in Price 2.0.x

File

src/Plugin/Validation/Constraint/CurrencyConstraint.php
View source
<?php

namespace Drupal\price\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;

/**
 * Currency constraint.
 *
 * @Constraint(
 *   id = "PriceCurrency",
 *   label = @Translation("Currency", context = "Validation"),
 *   type = { "price_price" }
 * )
 */
class CurrencyConstraint extends Constraint {

  /**
   * The array of available currencies.
   *
   * @var array
   */
  public $availableCurrencies = [];

  /**
   * The default violation message.
   *
   * @var string
   */
  public $invalidMessage = 'The currency %value is not valid.';

  /**
   * The "not available" message.
   *
   * @var string
   */
  public $notAvailableMessage = 'The currency %value is not available.';

}

Classes

Namesort descending Description
CurrencyConstraint Currency constraint.