Closed imageslr closed 6 years ago
@imageslr
The main idea here, is that you pass everything to the transformer and the transformer just returns the right data.
Thank you! I am now using the first method, and I will look the second one. Thank you again!
Dear all, excuse for my poor English.
I am a starter of this framework. Now I have question: how to add custom field in transformer based on outside variables?
To be specific, when fetching
/users/:id
, I want to add afollowing
field in the response JSON to show that whether current user is follow the fetched user.Now I'm doing it like this:
I want to know is there someway I can pass extra variables to transformer? Currently I can only set TransformerClass like this:
And I hope I can set
following
like this, just inside theUserTransformer
:Is there some better way to implement? Thank you!