applyCallbacks example


        } catch (\ReflectionException $e) {
            throw new RuntimeException(sprintf('Could not determine the class of the parameter "%s".', $parameterName), 0, $e);
        } catch (MissingConstructorArgumentsException $e) {
            if (!$parameter->getType()->allowsNull()) {
                throw $e;
            }

            return null;
        }

        return $this->applyCallbacks($parameterData$class->getName()$parameterName$format$context);
    }

    /** * @internal */
    protected function createChildContext(array $parentContext, string $attribute, ?string $format): array
    {
        if (isset($parentContext[self::ATTRIBUTES][$attribute])) {
            $parentContext[self::ATTRIBUTES] = $parentContext[self::ATTRIBUTES][$attribute];
        } else {
            unset($parentContext[self::ATTRIBUTES]);
        }

        } catch (\ReflectionException $e) {
            throw new RuntimeException(sprintf('Could not determine the class of the parameter "%s".', $parameterName), 0, $e);
        } catch (MissingConstructorArgumentsException $e) {
            if (!$parameter->getType()->allowsNull()) {
                throw $e;
            }

            return null;
        }

        return $this->applyCallbacks($parameterData$class->getName()$parameterName$format$context);
    }

    /** * @internal */
    protected function createChildContext(array $parentContext, string $attribute, ?string $format): array
    {
        if (isset($parentContext[self::ATTRIBUTES][$attribute])) {
            $parentContext[self::ATTRIBUTES] = $parentContext[self::ATTRIBUTES][$attribute];
        } else {
            unset($parentContext[self::ATTRIBUTES]);
        }
 catch (\Error $e) {
                if (($context[self::SKIP_UNINITIALIZED_VALUES] ?? $this->defaultContext[self::SKIP_UNINITIALIZED_VALUES] ?? true) && $this->isUninitializedValueError($e)) {
                    continue;
                }
                throw $e;
            }

            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) {
                
 catch (\Error $e) {
                if (($context[self::SKIP_UNINITIALIZED_VALUES] ?? $this->defaultContext[self::SKIP_UNINITIALIZED_VALUES] ?? true) && $this->isUninitializedValueError($e)) {
                    continue;
                }
                throw $e;
            }

            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) {
                
Home | Imprint | This part of the site doesn't use cookies.