function ClassMetadata::addPropertyConstraint
Adds a constraint to the given property.
Return value
$this
2 calls to ClassMetadata::addPropertyConstraint()
- 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}.
- ClassMetadata::addPropertyConstraints in vendor/
symfony/ validator/ Mapping/ ClassMetadata.php
File
-
vendor/
symfony/ validator/ Mapping/ ClassMetadata.php, line 222
Class
- ClassMetadata
- Default implementation of {@link ClassMetadataInterface}.
Namespace
Symfony\Component\Validator\MappingCode
public function addPropertyConstraint(string $property, Constraint $constraint) : static {
if (!isset($this->properties[$property])) {
$this->properties[$property] = new PropertyMetadata($this->getClassName(), $property);
$this->addPropertyMetadata($this->properties[$property]);
}
$constraint->addImplicitGroupName($this->getDefaultGroup());
$this->properties[$property]
->addConstraint($constraint);
return $this;
}