function ClassMetadata::addGetterConstraint
Adds a constraint to the getter of the given property.
The name of the getter is assumed to be the name of the property with an uppercased first letter and the prefix "get", "is" or "has".
Return value
$this
1 call to ClassMetadata::addGetterConstraint()
- ClassMetadata::addGetterConstraints in vendor/
symfony/ validator/ Mapping/ ClassMetadata.php
File
-
vendor/
symfony/ validator/ Mapping/ ClassMetadata.php, line 259
Class
- ClassMetadata
- Default implementation of {@link ClassMetadataInterface}.
Namespace
Symfony\Component\Validator\MappingCode
public function addGetterConstraint(string $property, Constraint $constraint) : static {
if (!isset($this->getters[$property])) {
$this->getters[$property] = new GetterMetadata($this->getClassName(), $property);
$this->addPropertyMetadata($this->getters[$property]);
}
$constraint->addImplicitGroupName($this->getDefaultGroup());
$this->getters[$property]
->addConstraint($constraint);
return $this;
}