Skip to content

[FrameworkBundle] Added configuration for additionnal request formats#9862

Closed
gquemener wants to merge 9 commits intosymfony:masterfrom
gquemener:master
Closed

[FrameworkBundle] Added configuration for additionnal request formats#9862
gquemener wants to merge 9 commits intosymfony:masterfrom
gquemener:master

Conversation

@gquemener
Copy link
Copy Markdown
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #8934
License MIT
Doc PR symfony/symfony-docs#3402

Reopening of #8944

TODO

@realityking
Copy link
Copy Markdown
Contributor

That's pretty useful. Could we add AddRequestFormatsListener to HttpKernel? It's certainly useful without the DIC.

@gquemener
Copy link
Copy Markdown
Contributor Author

That sounds like a good idea to me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testEmptyAdditionalrequestFormats?

@cordoval
Copy link
Copy Markdown
Contributor

@fabbot-io still needs some training to get good at analyzing typos in variables and test method names

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder if in symfony/symfony these are straight private

@fabpot
Copy link
Copy Markdown
Member

fabpot commented Dec 28, 2013

+1 for moving AddRequestFormatsListener to HttpKernel
+1 for removing the cookbook as soon as the doc are updated to explain the new way

@gquemener Can you rebase on current master so that we can get rid of the CS fixes that have been fixed since then?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of creating a parameter, I'd inject the value directly into the listener service (like done everywhere else).

@fabpot
Copy link
Copy Markdown
Member

fabpot commented Dec 28, 2013

additional_formats seems the wrong word as you can also override existing ones with this parameter.

@realityking
Copy link
Copy Markdown
Contributor

Probably out of scope for this pull request, but I wonder if we could have a way for bundles to add additional formats too. I currently have a bundle that needs to add a couple of formats. I could of course use the listener added here and add it a second time to the event listener but that seems unnecessary.

@gquemener
Copy link
Copy Markdown
Contributor Author

@fabpot Problem with formats is that it can make people think it'd be the only formats that are known, thus bringing confusion why html and json works whereas it hasn't been defined in the configuration.

But, except for that point which can be solved with good documentation, I'm not against using formats instead of additional_formats.

@fabpot
Copy link
Copy Markdown
Member

fabpot commented Dec 28, 2013

Note I was not suggesting to use formats. What about mime_types like used by the REST bundle? or request_formats?

@gquemener
Copy link
Copy Markdown
Contributor Author

The mime-type key is already used when configuring through xml.

        <framework:request>
             <framework:additional-format name="csv">
                 <framework:mime-type>text/csv</framework:mime-type>
                 <framework:mime-type>text/plain</framework:mime-type>
             </framework:additional-format>
         </framework:request>

This would be a problem if we replace additional_format by mime-type, wouldn't it?

In the other hand request_formats would be repetitive as request is used as the parent key.

IMO, just formats makes sense.

@gquemener
Copy link
Copy Markdown
Contributor Author

I've moved the listener to the HttpKernel component and dropped the unneeded DIC parameter

@gquemener
Copy link
Copy Markdown
Contributor Author

I've also rebased on master, but not sure it went well :-/

Anyway, I'll squash before merge at the end

@gquemener
Copy link
Copy Markdown
Contributor Author

ping @fabpot @cordoval

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be consistent adds

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.

6 participants