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
Using a DTO for batch operations #1554
Comments
Currently found a workaround by poking around in the code that handles I've added the following data transformer, which keeps the input DTO as is, when
I'm probably missing some config that enables this behavior without this custom class though, seems like a trivial use case. |
@ctrl-f5 Can I ask you to describe the way you did this more precisely? I really need that functionality now. Does |
Not this is for an action that does not use the messenger config, no idea if it works the same way when using messenger. |
Thanks for description and fast response @ctrl-f5 ! |
thanks @ctrl-f5 this is literally the only answer I found on the internets for this particular issue |
There is some discussion on batch operations here api-platform/core#1645
And the conclusion seems to be to just use DTOs for batch actions, so that's what I'm doing. But I can't get the DTO in my controller, it always want to deserialize it into the resource class, which ends up in a, Exception
Cannot create an instance of App\Entity\User from serialized data because its constructor requires parameter
The way to disable this normalization is to configure
input: false
, but then the request body does not get converted to the DTO anymore...So what's the DTO batch setup supposed to look like?
My current setup which produces the error looks like this:
The text was updated successfully, but these errors were encountered: