Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

ovidiuenache
Copy link
Contributor

@ovidiuenache ovidiuenache commented Dec 25, 2023

Q A
Branch? 7.1
Bug fix? no
New feature? yes
Deprecations? no
Issues #52782
License MIT

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.

@carsonbot
Copy link

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:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.1 branch.

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!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@ovidiuenache ovidiuenache changed the base branch from 6.4 to 7.1 December 26, 2023 16:42
@OskarStark OskarStark changed the title [HttpKernel] Add support for custom HTTP status code for the MapQueryParameter attribute [HttpKernel] Add support for custom HTTP status code for the `#[MapQueryParameter] attribute Dec 26, 2023
@OskarStark OskarStark modified the milestones: 6.4, 7.1 Dec 26, 2023
@OskarStark OskarStark changed the title [HttpKernel] Add support for custom HTTP status code for the `#[MapQueryParameter] attribute [HttpKernel] Add support for custom HTTP status code for the #[MapQueryParameter] attribute Dec 26, 2023
nicolas-grekas added a commit that referenced this pull request Dec 27, 2023
…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()`
Copy link
Member

@nicolas-grekas nicolas-grekas left a 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.

@nicolas-grekas
Copy link
Member

Thank you @ovidiuenache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants