Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AttributeMetadata.php

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\Mapping

Code

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;
    }
}
RSS feed
Powered by Drupal