diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index a31b105884e29..e79e5c85222d1 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -517,7 +517,10 @@ protected function getAttributeDenormalizationContext(string $class, string $att return array_merge($context, $metadata->getDenormalizationContextForGroups($this->getGroups($context))); } - private function getAttributeMetadata($objectOrClass, string $attribute): ?AttributeMetadataInterface + /** + * @internal + */ + protected function getAttributeMetadata(object|string $objectOrClass, string $attribute): ?AttributeMetadataInterface { if (!$this->classMetadataFactory) { return null; diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index 2113a2b53b551..98b0092f628b5 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -226,41 +226,6 @@ public function normalize(mixed $object, string $format = null, array $context = return $data; } - /** - * Computes the normalization context merged with current one. Metadata always wins over global context, as more specific. - */ - private function getAttributeNormalizationContext(object $object, string $attribute, array $context): array - { - if (null === $metadata = $this->getAttributeMetadata($object, $attribute)) { - return $context; - } - - return array_merge($context, $metadata->getNormalizationContextForGroups($this->getGroups($context))); - } - - /** - * Computes the denormalization context merged with current one. Metadata always wins over global context, as more specific. - */ - private function getAttributeDenormalizationContext(string $class, string $attribute, array $context): array - { - $context['deserialization_path'] = ($context['deserialization_path'] ?? false) ? $context['deserialization_path'].'.'.$attribute : $attribute; - - if (null === $metadata = $this->getAttributeMetadata($class, $attribute)) { - return $context; - } - - return array_merge($context, $metadata->getDenormalizationContextForGroups($this->getGroups($context))); - } - - private function getAttributeMetadata(object|string $objectOrClass, string $attribute): ?AttributeMetadataInterface - { - if (!$this->classMetadataFactory) { - return null; - } - - return $this->classMetadataFactory->getMetadataFor($objectOrClass)->getAttributesMetadata()[$attribute] ?? null; - } - /** * {@inheritdoc} */