8000 [Serializer] fix AbstractObjectNormalizer · symfony/symfony@fdb42bb · GitHub
[go: up one dir, main page]

Skip to content

Commit fdb42bb

Browse files
[Serializer] fix AbstractObjectNormalizer
1 parent c7b5802 commit fdb42bb

File tree

2 files changed

+4
-36
lines changed

2 files changed

+4
-36
lines changed

src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,10 @@ protected function getAttributeDenormalizationContext(string $class, string $att
517517
return array_merge($context, $metadata->getDenormalizationContextForGroups($this->getGroups($context)));
518518
}
519519

520-
private function getAttributeMetadata($objectOrClass, string $attribute): ?AttributeMetadataInterface
520+
/**
521+
* @internal
522+
*/
523+
protected function getAttributeMetadata(object|string $objectOrClass, string $attribute): ?AttributeMetadataInterface
521524
{
522525
if (!$this->classMetadataFactory) {
523526
return null;

src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -226,41 +226,6 @@ public function normalize(mixed $object, string $format = null, array $context =
226226
return $data;
227227
}
228228

229-
/**
230-
* Computes the normalization context merged with current one. Metadata always wins over global context, as more specific.
231-
*/
232-
private function getAttributeNormalizationContext(object $object, string $attribute, array $context): array
233-
{
234-
if (null === $metadata = $this->getAttributeMetadata($object, $attribute)) {
235-
return $context;
236-
}
237-
238-
return array_merge($context, $metadata->getNormalizationContextForGroups($this->getGroups($context)));
239-
}
240-
241-
/**
242-
* Computes the denormalization context merged with current one. Metadata always wins over global context, as more specific.
243-
*/
244-
private function getAttributeDenormalizationContext(string $class, string $attribute, array $context): array
245-
{
246-
$context['deserialization_path'] = ($context['deserialization_path'] ?? false) ? $context['deserialization_path'].'.'.$attribute : $attribute;
247-
248-
if (null === $metadata = $this->getAttributeMetadata($class, $attribute)) {
249-
return $context;
250-
}
251-
252-
return array_merge($context, $metadata->getDenormalizationContextForGroups($this->getGroups($context)));
253-
}
254-
255-
private function getAttributeMetadata(object|string $objectOrClass, string $attribute): ?AttributeMetadataInterface
256-
{
257-
if (!$this->classMetadataFactory) {
258-
return null;
259-
}
260-
261-
return $this->classMetadataFactory->getMetadataFor($objectOrClass)->getAttributesMetadata()[$attribute] ?? null;
262-
}
263-
264229
/**
265230
* {@inheritdoc}
266231
*/

0 commit comments

Comments
 (0)
0