How to override serializer config files


Hi everyone,

I’m struggeling with serialization in Sylius.

Context: After an order is completed I have to push that order to a third-party API-endpoint. So I created an new event listener where I’ll do my api-call. But because this order is a proxy object (in the event listeners method), it takes quite long to fetch all the data when json_encoding it (it even goes in time-out and circular reference errors and so). So I decided to serialize it by serializer-group.

But to only push the relevant info, I want to create a custom serializer-group. But I can’t seem to find how I can override the default serializer config files. I also added some extra properties to that Order entity and I would like to serialize these properties too.

Anyone who also had to do this and can give me a hint on how I can get this working? As there’s nothing mentioned in the docs about overriding of serializers? Or is this just default Symfony behaviour that I overlook?

Thanks in advance!

Kind regards!


same here
found this answer and looks right but did not work for me
i hope it work for you

if you found any solution please let me know thanks