function MappingCollectionConstraintValidator::validate

File

core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/MappingCollectionConstraintValidator.php, line 21

Class

MappingCollectionConstraintValidator
Validates the MappingCollection constraint.

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint

Code

public function validate(mixed $value, Constraint $constraint) : void {
  if (!$constraint instanceof MappingCollectionConstraint) {
    throw new UnexpectedTypeException($constraint, Collection::class);
  }
  if (NULL === $value) {
    return;
  }
  if (!$this->context
    ->getObject() instanceof Mapping) {
    throw new UnexpectedTypeException($this->context
      ->getObject(), Mapping::class);
  }
  $value = $this->context
    ->getObject()
    ->getIterator();
  parent::validate($value, $constraint);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.