public function ElementMetadata::addConstraint

Adds a constraint to this element.

Parameters

Constraint $constraint:

Return value

ElementMetadata

3 calls to ElementMetadata::addConstraint()
ClassMetadata::addConstraint in drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadata.php
Adds a constraint to this element.
ElementMetadata::__clone in drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ElementMetadata.php
Clones this object.
MemberMetadata::addConstraint in drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/MemberMetadata.php
Adds a constraint to this element.
2 methods override ElementMetadata::addConstraint()
ClassMetadata::addConstraint in drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadata.php
Adds a constraint to this element.
MemberMetadata::addConstraint in drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/MemberMetadata.php
Adds a constraint to this element.

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ElementMetadata.php, line 63

Class

ElementMetadata

Namespace

Symfony\Component\Validator\Mapping

Code

public function addConstraint(Constraint $constraint) {
  $this->constraints[] = $constraint;
  foreach ($constraint->groups as $group) {
    $this->constraintsByGroup[$group][] = $constraint;
  }
  return $this;
}