Message Body Mapping

The mapping is managed by MessageBodyMapperManager. Internally it delegates the mapping to the registered mappers. By default, the SerializerMapperAdapter is used if available.

Add/replace own mapper

Simply register your mapper by using the jungi.message_body_mapper tag with the media-type attribute (media_type for yaml).

<service id="custom_xml_mapper" class="App\Http\MessageConversion\CustomXmlMapper">
    <tag name="jungi.message_body_mapper" media-type="application/x-xml" />
    <tag name="jungi.message_body_mapper" media-type="application/xml" />
    <tag name="jungi.message_body_mapper" media-type="text/xml" />
    <!-- args -->
</service>

Last updated