[2.3][HttpFoundation] Allow MimeTypeGuesser to be constructed and customized outside of the singleton scope#7415
Closed
romainneutron wants to merge 1 commit intosymfony:masterfrom
Closed
Conversation
Allow singleton customization with the method `defineAsInstance`.
Member
|
Re-reading the code now, I think what you are trying to achieve is already possible without any modifications: MimeTypeGuesser::getInstance()->register(new CustomMimeTypeGuesser());As register always add the guesser before existing one, the custom guesser will always be called instead of the default ones. Am I missing something here? |
fabpot
added a commit
that referenced
this pull request
Apr 23, 2013
This PR was merged into the master branch. Discussion ---------- [WIP][HttpFoundation] File mime types and extensions | Q | A | ------------- | --- | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #5039, #6963, #5258, #7415, #5615 | License | MIT | Doc PR | n/a This pull request addresses most of the issues regarding mime types and extension on File instances. I've also created an issue on the docs to add more documentation about how things work (see symfony/symfony-docs#2542). Commits ------- acc2b6a [HttpFoundation] updated the list of known mime types (sync from Apache) f85cdd2 [HttpFoundation] fixed phpdoc 1aa68da [HttpFoundation] added a way to inject a custom magic file into FileinfoMimeTypeGuesser (closes #6963) 29b5413 [HttpFoundation] added some more phpdocs to clarify usage ee784fb clarified how/when to use client or guessed mime-types and extensions on a File instance (closes #5039)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow singleton customization with the method
defineAsInstance.For example, to use a unique
CustomMimeTypeGuesser:the following call to
MimeTypeGuesser::getInstance();will return the previously defined$guesser.