-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[HttpFoundation] Allow to get all the mime types associated to a format in the Request #17318
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
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.
Why not a static method?
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.
👍 we should also update the other related functions in another PR IMO: setFormat, getMimeType and getFormat.
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.
see #17379
aa38636 to
0f3af7d
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.
I think one more test could be useful, which asserts what getMimeTypes() returns, if the format is not found in Request::$formats.
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.
Good idea, added :-)
…at in the Request
|
👍 |
|
👍 |
|
👍 |
|
Thank you @Ener-Getick. |
…iated to a format in the Request (Ener-Getick) This PR was merged into the 3.1-dev branch. Discussion ---------- [HttpFoundation] Allow to get all the mime types associated to a format in the Request | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT This PR creates a new method in ``Request`` to allow to get all the mime types associated to a format. This is useful in the case of a format negotiator which needs to convert a list of format to a list of mime types (see [the ``FormatNegotiator`` of the ``FOSRestBundle``](https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/Negotiation/FormatNegotiator.php#L126)) Commits ------- 4618c9f [HttpFoundation] Allow to get all the mime types associated to a format in the Request
This PR creates a new method in
Requestto allow to get all the mime types F440 associated to a format.This is useful in the case of a format negotiator which needs to convert a list of format to a list of mime types (see the
FormatNegotiatorof theFOSRestBundle)