updateData example

    // are fixed before processing the node type's other dependents.     while ($dependent = array_pop($dependents_to_process)) {
      /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $dependent */
      if ($dry_run) {
        // Clone the entity so any changes do not change any static caches.         $dependent = clone $dependent;
      }
      $fixed = FALSE;
      if ($this->callOnDependencyRemoval($dependent$current_dependents$type$names)) {
        // Recalculate dependencies and update the dependency graph data.         $dependent->calculateDependencies();
        $dependency_manager->updateData($dependent->getConfigDependencyName()$dependent->getDependencies());
        // Based on the updated data rebuild the list of current dependents.         // This will remove entities that are no longer dependent after the         // recalculation.         $current_dependents = $this->findConfigEntityDependenciesAsEntities($type$names$dependency_manager);
        // Rebuild the list of entities that we need to process using the new         // list of current dependents and removing any entities that we've         // already processed.         $dependents_to_process = array_filter($current_dependentsfunction D$current_dependent) use ($affected_uuids) {
          return !in_array($current_dependent->uuid()$affected_uuids);
        });
        // Ensure that the dependent has actually been fixed. It is possible
if ($maxDepthReached) {
                $attributeValue = $maxDepthHandler($attributeValue$object$attribute$format$attributeContext);
            }

            $stack[$attribute] = $this->applyCallbacks($attributeValue$object$attribute$format$attributeContext);
        }

        foreach ($stack as $attribute => $attributeValue) {
            $attributeContext = $this->getAttributeNormalizationContext($object$attribute$context);

            if (null === $attributeValue || \is_scalar($attributeValue)) {
                $data = $this->updateData($data$attribute$attributeValue$class$format$attributeContext$attributesMetadata$classMetadata);
                continue;
            }

            if (!$this->serializer instanceof NormalizerInterface) {
                throw new LogicException(sprintf('Cannot normalize attribute "%s" because the injected serializer is not a normalizer.', $attribute));
            }

            $childContext = $this->createChildContext($attributeContext$attribute$format);

            $data = $this->updateData($data$attribute$this->serializer->normalize($attributeValue$format$childContext)$class$format$attributeContext$attributesMetadata$classMetadata);
        }

        
if ($maxDepthReached) {
                $attributeValue = $maxDepthHandler($attributeValue$object$attribute$format$attributeContext);
            }

            $stack[$attribute] = $this->applyCallbacks($attributeValue$object$attribute$format$attributeContext);
        }

        foreach ($stack as $attribute => $attributeValue) {
            $attributeContext = $this->getAttributeNormalizationContext($object$attribute$context);

            if (null === $attributeValue || \is_scalar($attributeValue)) {
                $data = $this->updateData($data$attribute$attributeValue$class$format$attributeContext$attributesMetadata$classMetadata);
                continue;
            }

            if (!$this->serializer instanceof NormalizerInterface) {
                throw new LogicException(sprintf('Cannot normalize attribute "%s" because the injected serializer is not a normalizer.', $attribute));
            }

            $childContext = $this->createChildContext($attributeContext$attribute$format);

            $data = $this->updateData($data$attribute$this->serializer->normalize($attributeValue$format$childContext)$class$format$attributeContext$attributesMetadata$classMetadata);
        }

        
Home | Imprint | This part of the site doesn't use cookies.