You are here

public function ClassMetadata::merge in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Mapping/ClassMetadata.php \Symfony\Component\Serializer\Mapping\ClassMetadata::merge()

Merges a {@link ClassMetadataInterface} in the current one.

Parameters

ClassMetadataInterface $classMetadata:

Overrides ClassMetadataInterface::merge

File

vendor/symfony/serializer/Mapping/ClassMetadata.php, line 81

Class

ClassMetadata
@author Kévin Dunglas <dunglas@gmail.com>

Namespace

Symfony\Component\Serializer\Mapping

Code

public function merge(ClassMetadataInterface $classMetadata) {
  foreach ($classMetadata
    ->getAttributesMetadata() as $attributeMetadata) {
    if (isset($this->attributesMetadata[$attributeMetadata
      ->getName()])) {
      $this->attributesMetadata[$attributeMetadata
        ->getName()]
        ->merge($attributeMetadata);
    }
    else {
      $this
        ->addAttributeMetadata($attributeMetadata);
    }
  }
}