Skip to content

CircularReferenceException in custom ItemDataProvider #1165

@vincentchalamon

Description

@vincentchalamon

Hello,

I'm implementing 2 custom data providers, connecting on WordPress API: 1 for collection, 1 for item. For the first one, I can easily inject the serializer service. But for the item, I get a CircularReferenceException.

A solution would be to create an event subscriber which listens to kernel.request event and serialize the controller result, but it's not generic at all (and I don't find it very clean…).

A better solution would be to listen to SerializerAwareInterface on my ItemDataProvider from API Platform, and if so call setSerializer method.

What do you think of it @api-platform/core-team?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions