Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ClassMetadata.php

function ClassMetadata::checkConstraint

1 call to ClassMetadata::checkConstraint()
ClassMetadata::addConstraint in vendor/symfony/validator/Mapping/ClassMetadata.php
If the constraint {@link Cascade} is added, the cascading strategy will be changed to {@link CascadingStrategy::CASCADE}.

File

vendor/symfony/validator/Mapping/ClassMetadata.php, line 474

Class

ClassMetadata
Default implementation of {@link ClassMetadataInterface}.

Namespace

Symfony\Component\Validator\Mapping

Code

private function checkConstraint(Constraint $constraint) : void {
    if (!\in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets(), true)) {
        throw new ConstraintDefinitionException(\sprintf('The constraint "%s" cannot be put on classes.', get_debug_type($constraint)));
    }
    if ($constraint instanceof Composite) {
        foreach ($constraint->getNestedConstraints() as $nestedConstraint) {
            $this->checkConstraint($nestedConstraint);
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal