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\MappingCode
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);
}
}
}