Adds services to the Serializer.
\Symfony\Component\DependencyInjection\ContainerBuilder $container: The container to process.
Overrides CompilerPassInterface::process
public function process(ContainerBuilder $container) {
$definition = $container
->getDefinition('serializer.entity_resolver');
// Retrieve registered Normalizers and Encoders from the container.
foreach ($container
->findTaggedServiceIds('entity_resolver') as $id => $attributes) {
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
$resolvers[$priority][] = new Reference($id);
}
// Add the registered concrete EntityResolvers to the ChainEntityResolver.
if (!empty($resolvers)) {
$definition
->replaceArgument(0, $this
->sort($resolvers));
}
}