throw new RuntimeException('You must tag at least one service as "serializer.normalizer" to use the "serializer" service.'
);
} if (!
$encoders =
$this->
findAndSortTaggedServices('serializer.encoder',
$container)) { throw new RuntimeException('You must tag at least one service as "serializer.encoder" to use the "serializer" service.'
);
} if ($container->
hasParameter('serializer.default_context'
)) { $defaultContext =
$container->
getParameter('serializer.default_context'
);
foreach (array_merge($normalizers,
$encoders) as $service) { $definition =
$container->
getDefinition($service);
$definition->
setBindings(['array $defaultContext' =>
new BoundArgument($defaultContext, false
)] +
$definition->
getBindings());
} $container->
getParameterBag()->
remove('serializer.default_context'
);
} if ($container->
getParameter('kernel.debug'
) &&
$container->
hasDefinition('serializer.data_collector'
)) { foreach ($normalizers as $i =>
$normalizer) { $normalizers[$i] =
$container->
register('.debug.serializer.normalizer.'.
$normalizer, TraceableNormalizer::
class) ->
setArguments([$normalizer,
new Reference('serializer.data_collector'
)]);
}