IvorySerializerBundle icon indicating copy to clipboard operation
IvorySerializerBundle copied to clipboard

FOSRestBundle integration does not work

Open dinamic opened this issue 7 years ago • 1 comments

I have tried following the documentation on this, but it does not seem to work.

Seems like there are multiple exceptions here.

  [Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
  Unable to replace alias "fos_rest.serializer" with actual definition "ivory.serializer.fos".

  [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
  You have requested a non-existent service "ivory.serializer.fos".

ENV:

  • Symfony 3.3.15
  • FOSRestBundle 2.3.0

dinamic avatar Jan 29 '18 17:01 dinamic

Here's the solution that I have come up with:

# app/config/config.yml

#fos_rest:
#    service:
#        serializer: ivory.serializer.fos
# app/config/services.yml

services:
    fos_rest.serializer:
        class: 'Ivory\SerializerBundle\FOS\Serializer'
        arguments:
          - '@ivory.serializer'

Maybe this could be added to the docs? Thoughts, @egeloen?

dinamic avatar Jan 29 '18 17:01 dinamic