Skip to content
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.3] Throw an InvalidArgument when trying to get Item from a collection route #2219

Merged
merged 1 commit into from
Oct 1, 2018

Conversation

antograssiot
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

When using the search filter on an exact association for example, if the obviously bad value is a matching collection url, the filter IriConverter will throw Either \"item_operation_name\" or \"collection_operation_name\" must be defined, unless the \"_api_receive\" request attribute is set to false.

This is because getItemFromIri() will get a match on the router but won't match the expected the attributes.

an easy way to reproduce this on the demo is to try to filter /reviews?book=foo versus /reviews?book=parchments or /reviews?book=book

@antograssiot antograssiot changed the title Throw an InvalidArgument when trying to get Item from a collection route [2.3] Throw an InvalidArgument when trying to get Item from a collection route Sep 27, 2018
@dunglas dunglas merged commit e17a44e into api-platform:2.3 Oct 1, 2018
@dunglas
Copy link
Member

dunglas commented Oct 1, 2018

Nice DX improvement! Thanks @antograssiot

@antograssiot antograssiot deleted the get-item-on-collection branch October 1, 2018 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants