Limenius / LiformBundle

Symfony Bundle to render Symfony Forms to JSON Schema
MIT License
138 stars 43 forks source link

There is no "serializer" service #14

Closed jakub-zawislak closed 5 years ago

jakub-zawislak commented 6 years ago

Docs says:

This bundle registers a normalizer to serialize forms with errors into an array.

$serializer = $this->get('serializer');
$initialValues = $serializer->normalize($form);

but there is no "serializer" service registered. I see in services.yml that there is InitialValuesNormalizer

<service id="liform.serializer.initial_values_normalizer" class="Limenius\Liform\Serializer\Normalizer\InitialValuesNormalizer" public="false">
  <tag name="serializer.normalizer" priority="-10" />
</service>

but it is public="false" so I can't access it.

I have eneded with this:

$normalizer = new \Limenius\Liform\Serializer\Normalizer\InitialValuesNormalizer();
$initialValues = $normalizer->normalize($form);
VictoriaQ commented 5 years ago

This was fixed in f96cd655e91eedd5588cd31291c6ba04b20a7f27