-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include underscore not working #67
Comments
This is currently not possible, and I don't think we can easily support this without braking existing functionality. It might be possible to implement this with a custom Serializer. However, I do think we should support includes with underscores. I might take a look at it. I'd also happily accept a PR. |
I published version 2.1.0 that now supports snake_case include properties. It should now work as you'd expect and your example from the initial post should work: static get availableInclude () {
return ['amount_used', 'administrator']
}
includeAmountUsed (coupon) {
const {amount_used} = coupon.toJSON ()
return amount_used
} |
First of all, i'm not a native speaker and i used google translator to help me write this issue.
By now congratulations on the package. It is very useful and practical
I am having difficulties adding an underscore property in the available include
On my Transformer:
In Controller:
JSON response example:
Already tried a debug or add a console log in includeAmountUsed, but the function is not called. I have also tried renaming the function to includeAmount_used, includeAmount_Used.
If rename the property to amountUsed works perfectly, but I wanted JSON to be amount_used, can you help me? Thanks
The text was updated successfully, but these errors were encountered: