-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Add support for custom HTTP status code for the #[MapQueryParameter]
attribute
#53209
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
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
9db9710
to
cc784f6
Compare
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/QueryParameterValueResolver.php
Outdated
Show resolved
Hide resolved
cc784f6
to
94836b8
Compare
#[MapQueryParameter]
attribute
94836b8
to
454d3aa
Compare
…colas-grekas) This PR was merged into the 7.1 branch. Discussion ---------- [HttpKernel] Add `HttpException::fromStatusCode()` | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | - | License | MIT A small helper idea that popped up when reviewing #53209 Commits ------- 98f4fa1 [HttpKernel] Add `HttpException::fromStatusCode()`
454d3aa
to
c681fe2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one minor comment.
src/Symfony/Component/HttpKernel/Attribute/MapQueryParameter.php
Outdated
Show resolved
Hide resolved
…Parameter attribute
d33e181
to
c9f33bb
Compare
Thank you @ovidiuenache. |
Issue #52782 was created where the need to have a custom HTTP status code for the MapQueryParameter attribute was stated. As part of the discussion, @nicolas-grekas suggested an approach similar to the implementation of the MapQueryString attribute where such a status code can be provided in the attribute's constructor.
I believe having the possibility to control the status code returned for an invalid and non-nullable parameter with no default value would be a great addition so I took the liberty to create this PR.
This change is backward compatible.