Closed vylink closed 5 years ago
I think you could redefine JsonUnifyTransformer.
What is your usecase for that? Unified data format is mean to be used just for status
, data
and errors
I would like to send updated authentication token in all responses.... and I'd like to keep "data" node just for actual data... Can you point me how to "redefine JsonUnifyTransformer"?
Kind Regards,
M
Extend JsonUnifyTransfomer and replace service in DIC
services:
api.negotiation.transformer.json:
class: App\Api\Transformer\JsonUnifyTransformerTransformer
alteration: true
You can add these informations to request and response through withAttribute()
and get it with getAttribute()
Many thanks. It works!!!
I'm using decorator to add some additional data into all responses...
This returns all responses as following example:
My question is if is there any way, how can I move "somedata" node to same level as "status" and "data" nodes.
Cheers