JMSSerializerBundle with Api-Platform
See original GitHub issueSo I may not need the JMSSerializerBundle anymore, but it’s currently installed, and I’m getting the following error… what do I do now?
FatalThrowableError in DeserializeListener.php line 33:
Type error: Argument 1 passed to ApiPlatform\Core\EventListener\DeserializeListener::__construct() must be an instance of Symfony\Component\Serializer\SerializerInterface, instance of JMS\Serializer\Serializer given, called in /tmp/project-indian/dev/cache/appDevDebugProjectContainer.php on line 988
in DeserializeListener.php line 33
at DeserializeListener->__construct(object(Serializer), object(SerializerContextBuilder), array('jsonld' => array('application/ld+json'), 'json' => array('application/json'), 'html' => array('text/html'))) in appDevDebugProjectContainer.php line 988
at appDevDebugProjectContainer->getApiPlatform_Listener_Request_DeserializeService() in Container.php line 310
at Container->get('api_platform.listener.request.deserialize') in ContainerAwareEventDispatcher.php line 181
at ContainerAwareEventDispatcher->lazyLoad('kernel.request') in ContainerAwareEventDispatcher.php line 127
at ContainerAwareEventDispatcher->getListeners('kernel.request') in TraceableEventDispatcher.php line 242
at TraceableEventDispatcher->preProcess('kernel.request') in TraceableEventDispatcher.php line 131
at TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in HttpKernel.php line 129
at HttpKernel->handleRaw(object(Request), 1) in HttpKernel.php line 68
at HttpKernel->handle(object(Request), 1, true) in Kernel.php line 168
at Kernel->handle(object(Request)) in app_dev.php line 15
Currently stuck in my development if I can’t move past this. Would really love to use the api-platform/core in my existing project…
I look forward to your response! Jarvis
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
The Serialization Process - API Platform
API Platform allows you to specify the $context variable used by the Symfony Serializer. This variable is an associative array that has a...
Read more >Using a Serializer > Symfony RESTful API - SymfonyCasts
The one we'll use is called "JMS Serializer" and there's a bundle for it called JMSSerializerBundle. This is a fanstatic library and incredibly...
Read more >Serializing data in PHP: A simple primer on the JMS Serializer ...
We'll create an “Address” class, import the JMS Serializer bundle and ... larger project called api-platform which has better documentation.
Read more >symfony api-platform depth - Stack Overflow
Which is quite different from what e.g. JMS serializer is doing, where MaxDepth really means "From here on, max N steps into the...
Read more >api-platform/api-platform - Gitter
I thought is is possible to provide JMS serializer as basic serialization provider for API-Platform and use it features using annotations, but looks...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In case the title of this issue is confusing, it’s not about how to use the JMS Serializer in API Platform. That is impossible. But you can let JMS Serializer co-exist with Symfony Serializer, which is already the case out of the box, since
jms/serializer-bundle >= v2.0
The reason that option has been removed is because JMSSerializerBundle no longer registers the short alias. So there’s no more opportunity for conflict.
@karousn If you need help, please give us more details of the problem you’re facing. 😄