class CompositeConstraintBase

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/CompositeConstraintBase.php \Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase
  2. 8.9.x core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/CompositeConstraintBase.php \Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase
  3. 11.x core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/CompositeConstraintBase.php \Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase

Provides a base class for constraints validating multiple fields.

The constraint must be defined on entity-level; i.e., added to the entity type.

Hierarchy

  • class \Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase extends \Symfony\Component\Validator\Constraint

Expanded class hierarchy of CompositeConstraintBase

See also

\Drupal\Core\Entity\EntityType::addConstraint

6 files declare their use of CompositeConstraintBase
CommentNameConstraint.php in core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraint.php
EntityConstraintViolationList.php in core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php
EntityTestCompositeConstraint.php in core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/EntityTestCompositeConstraint.php
EntityValidationTest.php in core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php
MenuTreeHierarchyConstraint.php in core/modules/menu_link_content/src/Plugin/Validation/Constraint/MenuTreeHierarchyConstraint.php

... See full list

File

core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/CompositeConstraintBase.php, line 15

Namespace

Drupal\Core\Entity\Plugin\Validation\Constraint
View source
abstract class CompositeConstraintBase extends Constraint {
    
    /**
     * An array of entity fields which should be passed to the validator.
     *
     * @return string[]
     *   An array of field names.
     */
    public abstract function coversFields();

}

Members

Title Sort descending Modifiers Object type Summary Overrides
CompositeConstraintBase::coversFields abstract public function An array of entity fields which should be passed to the validator. 4

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