NoFieldItemsExistWithHigherCardinality.php

Namespace

Drupal\field\Plugin\Validation\Constraint

File

core/modules/field/src/Plugin/Validation/Constraint/NoFieldItemsExistWithHigherCardinality.php

View source
<?php

declare (strict_types=1);
namespace Drupal\field\Plugin\Validation\Constraint;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;
use Drupal\Core\Validation\Attribute\Constraint;

/**
 * Checks if field items exist that exceed the allowed cardinality.
 */
class NoFieldItemsExistWithHigherCardinality extends SymfonyConstraint {
  public function __construct(public string $entityType, public string $fieldName, public string $message = "The field '@field_name' of entity type '@entity_type' has more entries (@max_delta) than the cardinality (@cardinality) allows.", ?array $groups = NULL, mixed $payload = NULL) {
    parent::__construct(groups: $groups, payload: $payload);
  }

}

Classes

Title Deprecated Summary
NoFieldItemsExistWithHigherCardinality Checks if field items exist that exceed the allowed cardinality.

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