public function ClassMetadata::mergeConstraints in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/Mapping/ClassMetadata.php \Symfony\Component\Validator\Mapping\ClassMetadata::mergeConstraints()
Merges the constraints of the given metadata into this object.
Parameters
ClassMetadata $source The source metadata:
File
- vendor/
symfony/ validator/ Mapping/ ClassMetadata.php, line 342
Class
- ClassMetadata
- Default implementation of {@link ClassMetadataInterface}.
Namespace
Symfony\Component\Validator\MappingCode
public function mergeConstraints(ClassMetadata $source) {
foreach ($source
->getConstraints() as $constraint) {
$this
->addConstraint(clone $constraint);
}
foreach ($source
->getConstrainedProperties() as $property) {
foreach ($source
->getPropertyMetadata($property) as $member) {
$member = clone $member;
foreach ($member
->getConstraints() as $constraint) {
$constraint
->addImplicitGroupName($this
->getDefaultGroup());
}
$this
->addPropertyMetadata($member);
if ($member instanceof MemberMetadata && !$member
->isPrivate($this->name)) {
$property = $member
->getPropertyName();
if ($member instanceof PropertyMetadata && !isset($this->properties[$property])) {
$this->properties[$property] = $member;
}
elseif ($member instanceof GetterMetadata && !isset($this->getters[$property])) {
$this->getters[$property] = $member;
}
}
}
}
}