You are here

class EntityTestCompositeConstraint in Drupal 10

Same name in this branch
  1. 10 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCompositeConstraint.php \Drupal\entity_test\Entity\EntityTestCompositeConstraint
  2. 10 core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/EntityTestCompositeConstraint.php \Drupal\entity_test\Plugin\Validation\Constraint\EntityTestCompositeConstraint
Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/EntityTestCompositeConstraint.php \Drupal\entity_test\Plugin\Validation\Constraint\EntityTestCompositeConstraint
  2. 9 core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/EntityTestCompositeConstraint.php \Drupal\entity_test\Plugin\Validation\Constraint\EntityTestCompositeConstraint

Constraint with multiple fields.

Plugin annotation


@Constraint(
  id = "EntityTestComposite",
  label = @Translation("Constraint with multiple fields."),
  type = "entity"
)

Hierarchy

Expanded class hierarchy of EntityTestCompositeConstraint

1 file declares its use of EntityTestCompositeConstraint
EntityConstraintViolationListTest.php in core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php

File

core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/EntityTestCompositeConstraint.php, line 16

Namespace

Drupal\entity_test\Plugin\Validation\Constraint
View source
class EntityTestCompositeConstraint extends CompositeConstraintBase {
  public $message = 'Multiple fields are validated';

  /**
   * {@inheritdoc}
   */
  public function coversFields() {
    return [
      'name',
      'type',
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityTestCompositeConstraint::$message public property
EntityTestCompositeConstraint::coversFields public function An array of entity fields which should be passed to the validator. Overrides CompositeConstraintBase::coversFields