-
-
Notifications
You must be signed in to change notification settings - Fork 889
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
[2.4.3] No resource class found for object of type when using DTO as output #2860
Comments
Can you share the full stack trace please? Serializing with an output DTO is not supposed to hit this code path, but clearly there's a bug somewhere. |
Sure, I'll attach the stack trace in a few hours.
…On Fri, Jun 14, 2019, 15:38 Teoh Han Hui ***@***.*** wrote:
Can you share the full stack trace please? Serializing with an output DTO
is not supposed to hit this code path, but clearly there's a bug somewhere.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2860?email_source=notifications&email_token=AAMY6GPDAYDGXRYHAI7MZ53P2OGKXA5CNFSM4HX7S5WKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXWVK7Y#issuecomment-502093183>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAMY6GMDNBCUXMQJM5LVYB3P2OGKXANCNFSM4HX7S5WA>
.
|
Ok, it is
|
@karser You should not return What you should do is to implement a DataTransformer that transforms your resource class to the output class. |
I don't think this issue is invalid, I believe that there is a misunderstanding of the use case. Let's take a look at the forgot password case. Here is pseudo-code:
Originally I was using the @lyrixx approach. Then after the output and messenger support were added to api-platform, the following worked quite well (until v2.4.3):
|
@karser Yes, the way you use it is wrong: public function __invoke(ForgotPasswordRequest $request): ForgotPasswordResponse; You're expected to return |
What would ForgotPassword case pseudo-code look like? |
In your case, I'd say |
Fixed by #2910 |
Hi Folks!
I'm using api-platform for handling custom use cases:
This configuration worked well with v2.4.2. After upgrading to 2.4.3 (and 2.4.4 as well) I started getting this issue:
So
IriConverter::getIriFromItem
callsResourceClassResolver::getResourceClass
which throwsInvalidArgumentException
if the output is not an api resource.As a workaround I decorated IriConverter and added fallback:
I'm wondering is it a bug and how to better approach this issue? Is IRI critically important for the non-resource output?
The text was updated successfully, but these errors were encountered: