0
votes

I am trying to set up service for normalizer to add extra data.

I have followed the documentation which uses ld+json and it works fine https://api-platform.com/docs/core/serialization/#decorating-a-serializer-and-adding-extra-data

But the problem is that I need it in json, not ld+json, so I jave changed api_platform.jsonld.normalizer.item to api_platform.jsonapi.normalizer.item as the autocomplete in phpstorm suggested to do, but this service seems to be not defined, and in the documentation I cannot find.

I have also tried to use api_platform.json.normalizer.item but without luck.

My question is, how is the service called for the json item normalizer?

Thank you

1

1 Answers

0
votes

I have figured it out, it should be api_platform.serializer.normalizer.item

services:
    'App\Serializer\ApiNormalizer':
        decorates: 'api_platform.serializer.normalizer.item'
        arguments: ['@App\Serializer\ApiNormalizer.inner', '@doctrine.orm.entity_manager']