Replies: 2 comments
-
Interesting discussion indeed. I've bumped into this as well. The DTO represents the data model exposed through the API, but that does not mean i also want to use this object internally. In my case i wanted to add a computed field to the output but still use the resource object inside the voter and/or other business logic. I am curious how others think about this. |
Beta Was this translation helpful? Give feedback.
-
For reference our current tests around DTOs with a link to doctrine entities can be found at: https://github.com/api-platform/core/blob/92a81f024541054b9322e7457b75c721261e14e0/features/doctrine/separated_resource.feature. Note that Write operations don't really have such support yet and this is only for read operations. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Since Data Transformers were removed, I cannot find a way to use output DTO with nested transformation: only the root item will use the Provider, not its sub-resources.
Also, DTO resulting from provider is passed as security object, instead of the resource object (#2466)
Am I missing something or am I the only one to use DTOs? ^^
I believe output DTOs should only reside in the serialization process (it's a representation) whereas Provider's role is to provide resource object (not the DTO) from storage layer.
Thanks for maintaining this project!
Beta Was this translation helpful? Give feedback.
All reactions