You are here

PhpDateIntervalConstraint.php in Duration Field 3.0.x

Same filename and directory in other branches
  1. 8.2 src/Plugin/Validation/Constraint/PhpDateIntervalConstraint.php

File

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

namespace Drupal\duration_field\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;

/**
 * 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.
 *
 * @Constraint(
 *   id = "php_date_interval",
 *   label = @Translation("PHP Date Interval", context = "Validation"),
 *   type = "string"
 * )
 */
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';

}

Classes

Namesort descending Description
PhpDateIntervalConstraint Checks that the submitted value is a valid value for a Date Interval object.