function AttributeMetadata::merge
Overrides AttributeMetadataInterface::merge
File
-
vendor/
symfony/ serializer/ Mapping/ AttributeMetadata.php, line 195
Class
- AttributeMetadata
- @author Kévin Dunglas <dunglas@gmail.com>
Namespace
Symfony\Component\Serializer\MappingCode
public function merge(AttributeMetadataInterface $attributeMetadata) : void {
foreach ($attributeMetadata->getGroups() as $group) {
$this->addGroup($group);
}
// Overwrite only if not defined
$this->maxDepth ??= $attributeMetadata->getMaxDepth();
$this->serializedName ??= $attributeMetadata->getSerializedName();
$this->serializedPath ??= $attributeMetadata->getSerializedPath();
// Overwrite only if both contexts are empty
if (!$this->normalizationContexts && !$this->denormalizationContexts) {
$this->normalizationContexts = $attributeMetadata->getNormalizationContexts();
$this->denormalizationContexts = $attributeMetadata->getDenormalizationContexts();
}
if ($ignore = $attributeMetadata->isIgnored()) {
$this->ignore = $ignore;
}
}