Closed
Description
Description
AFAIK there is no way to provide a YamlEncoder
default context or JsonEncoder
json decoder service (with custom options) from configuration.
It would great to be able to do it.
Example
framework:
serializer:
name_converter: serializer.name_converter.camel_case_to_snake_case
encoders:
yaml:
inline: 10
Possible Workaround
On the kernel, overwrite the definitions (example with the yaml encoder):
final class Kernel extends BaseKernel implements CompilerPassInterface
{
use MicroKernelTrait;
// ...
public function process(ContainerBuilder $container): void
{
$container->getDefinition('serializer.encoder.yaml')
->setArguments([null, null, [
'yaml_inline' => 10,
]])
;
// ...