-
-
Notifications
You must be signed in to change notification settings - Fork 897
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
Use PHP8 return type instead of annotations #6776
Comments
I expect this is an issue from symfony? But it's weird, what property info extractor are registered on your project? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Sorry for the late reply. We had the problem again today, only with a lot more “add” and “get” methods. |
Could you help tracking this by checking values at https://github.com/api-platform/core/blob/main/src/Metadata/Property/Factory/PropertyInfoPropertyMetadataFactory.php#L48-L59 ? (remove your cache if you don't hit these lines) I need to know if this needs fixing in symfony or in our codebase, thanks! |
I just tested again whether I can get into the foreach, but I can't get in at the moment. EDIT: With the annotations, however, the call works in the frontend without the error message “Unexpected non-iterable value for to-many relation”. |
since symfony/symfony#57617 got merged, can you try #6947 ? |
I have just tested it, but I still get the error when I remove the annotations. |
API Platform version(s) affected:
I currently use api-platform/symfony in version 4.0.6
Description
The PHP8 return data type of the method is ignored. Only the old notation for annotations is taken into account.
You then get an error message when you call the whole thing via the API platform: Unexpected non-iterable value for to-many relation.
How to reproduce
I call a collection in my entity and only want to return a single item or null from it.
Possible Solution
Currently you can fix the error by returning the return type in the annotation.
The text was updated successfully, but these errors were encountered: