Skip to content

[FrameworkBundle] move wiring of the property info extractor to the ObjectNormalizer #54791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
move wiring of the property info extractor to the ObjectNormalizer
The PropertyNormalizer does not handle a property info extractor. It looks
like the argument was accidentally added to instead of the ObjectNormalizer
in #52917.
  • Loading branch information
xabbuh committed Apr 30, 2024
commit 518bc283a0793868584d1624900d8c8752839c6c
Original file line number Diff line number Diff line change
Expand Up @@ -1854,18 +1854,19 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
$container->setParameter('serializer.default_context', $defaultContext);
}

$arguments = $container->getDefinition('serializer.normalizer.object')->getArguments();
$context = [];

if (isset($config['circular_reference_handler']) && $config['circular_reference_handler']) {
$arguments = $container->getDefinition('serializer.normalizer.object')->getArguments();
$context = ($arguments[6] ?? $defaultContext) + ['circular_reference_handler' => new Reference($config['circular_reference_handler'])];
$context += ($arguments[6] ?? $defaultContext) + ['circular_reference_handler' => new Reference($config['circular_reference_handler'])];
$container->getDefinition('serializer.normalizer.object')->setArgument(5, null);
$container->getDefinition('serializer.normalizer.object')->setArgument(6, $context);
}

if ($config['max_depth_handler'] ?? false) {
$arguments = $container->getDefinition('serializer.normalizer.object')->getArguments();
$context = ($arguments[6] ?? $defaultContext) + ['max_depth_handler' => new Reference($config['max_depth_handler'])];
$container->getDefinition('serializer.normalizer.object')->setArgument(6, $context);
$context += ($arguments[6] ?? $defaultContext) + ['max_depth_handler' => new Reference($config['max_depth_handler'])];
}

$container->getDefinition('serializer.normalizer.object')->setArgument(6, $context);
}

private function registerPropertyInfoConfiguration(ContainerBuilder $container, PhpFileLoader $loader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@
service('property_info')->ignoreOnInvalid(),
service('serializer.mapping.class_discriminator_resolver')->ignoreOnInvalid(),
null,
null,
service('property_info')->ignoreOnInvalid(),
])
->tag('serializer.normalizer', ['priority' => -1000])

Expand All @@ -138,7 +140,6 @@
service('serializer.mapping.class_discriminator_resolver')->ignoreOnInvalid(),
null,
[],
service('property_info')->ignoreOnInvalid(),
])

->alias(PropertyNormalizer::class, 'serializer.normalizer.property')
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy