class CountConstraint
Same name in other branches
- 9 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/CountConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\CountConstraint
- 8.9.x core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/CountConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\CountConstraint
- 11.x core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/CountConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\CountConstraint
Count constraint.
Overrides the symfony constraint to use Drupal-style replacement patterns.
Hierarchy
- class \Drupal\Core\Validation\Plugin\Validation\Constraint\CountConstraint extends \Symfony\Component\Validator\Constraints\Count
Expanded class hierarchy of CountConstraint
File
-
core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ CountConstraint.php, line 14
Namespace
Drupal\Core\Validation\Plugin\Validation\ConstraintView source
class CountConstraint extends Count {
/**
* {@inheritdoc}
*/
public function __construct(...$args) {
$this->minMessage = 'This collection should contain %limit element or more.|This collection should contain %limit elements or more.';
$this->maxMessage = 'This collection should contain %limit element or less.|This collection should contain %limit elements or less.';
$this->exactMessage = 'This collection should contain exactly %limit element.|This collection should contain exactly %limit elements.';
parent::__construct(...$args);
}
/**
* {@inheritdoc}
*
* @return string
* The name of the class that validates this constraint.
*
* @todo Add method return type declaration.
* @see https://www.drupal.org/project/drupal/issues/3425150
*/
public function validatedBy() {
return '\\Symfony\\Component\\Validator\\Constraints\\CountValidator';
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
CountConstraint::validatedBy | public | function | @todo Add method return type declaration. |
CountConstraint::__construct | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.