You are here

class PhpDateIntervalConstraint in Duration Field 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Validation/Constraint/PhpDateIntervalConstraint.php \Drupal\duration_field\Plugin\Validation\Constraint\PhpDateIntervalConstraint

Checks that the submitted value is a valid value for a Date Interval object.

Valid values are either PHP DateInterval objects, or an ISO 8601 duration string.

Plugin annotation


@Constraint(
  id = "php_date_interval",
  label = @Translation("PHP Date Interval", context = "Validation"),
  type = "string"
)

Hierarchy

  • class \Drupal\duration_field\Plugin\Validation\Constraint\PhpDateIntervalConstraint extends \Symfony\Component\Validator\Constraint

Expanded class hierarchy of PhpDateIntervalConstraint

File

src/Plugin/Validation/Constraint/PhpDateIntervalConstraint.php, line 19

Namespace

Drupal\duration_field\Plugin\Validation\Constraint
View source
class PhpDateIntervalConstraint extends Constraint {

  /**
   * The message shown when the value is not a valid PHP DateInterval object.
   *
   * @var string
   */
  public $notDateInterval = '%value is not valid for a PHP DateInterval object';

}

Members

Namesort descending Modifiers Type Description Overrides
PhpDateIntervalConstraint::$notDateInterval public property The message shown when the value is not a valid PHP DateInterval object.