[Question] Accessing Manager from inside Transformer
Closed this issue · 4 comments
Hi, just curious if there is a way to change serializer from inside the transformer.
Sometime when returning X-to-one relation it's better to change from DataSerializer into PlainSerializer (Resource.item()) since it will have another nesting variable inside the relations.
Already read the code, but can't find out myself. Thanks for the help.
This is currently not supported.
It might be something we can solve with a custom serializer. But we would have to provide the serializer with information about the nesting level. I'll take a look at this.
I tried a few things and came up with the sld (single-level-data) serializer.
It is currently in a feature branch. Would you mind checking it out and letting me know if this fits your usecase?
npm install --save rhwilr/adonis-bumblebee#single-level-data-serializer
You'll have to set the serializer to sld
in the config.
Thanks for the feedback. This feature has now been released in version 2.2.0.
@dimassrio If this didn't address your issue, please let me know.