JMSSerializerBundle: Can't use symfony serializer when requesting the id "serializer"
I want to use the symfony serializer and found this in the services.xml of this bundle
<service id="serializer" alias="jms_serializer.serializer" /><!-- Here for BC, may be disabled in the config -->
I saw, that you can disable it by setting enable_short_alias: false
which I did in my config.yml, however, now, every service which needs the “serializer” gets this error
Unable to replace alias "fos_elastica.serializer" with actual definition "serializer".
and You have requested a non-existent service "serializer".
When I debug through my code and am in the ContainerBuilder::getDefinition
method, inspecting the $this->definitions
is showing me, that there is no serializer
registered. I deleted the cache of course, but nothin ghappened. Any idea what this could be? This is the serializer.xml of the FrameworkBundle of Symfony
<service id="serializer" class="Symfony\Component\Serializer\Serializer">
<argument type="collection" />
<argument type="collection" />
</service>
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16
Update: If I change that to
it works again (so far). Thanks for your help, just misconfigured it apparently.
Ok, final answer. It seems to work now 😄. Don’t know what I changed between now and the previous comments, but I’m good to go now, finally> Thanks for your time.
I want to use both. We use the JMS-Serializer for our API but I know wanted to normalize an object (use the basic serializer functionality), because the JMSSerializer in our version doesn’t have the method
normalize
.Isn’t it possible to use both at the same time?