-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Add BC layer and FormView handling after #46854 #47600
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
5371f91
to
45ca5ed
Compare
->always() | ||
->then(function ($v) { | ||
if (false === $v) { | ||
trigger_deprecation('symfony/framework-bundle', '6.2', 'Setting the "framework.form.controllers_render_form_views" option to "false" is deprecated. It will have no effect as of Symfony 7.0.'); |
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.
instead of using ->always()
and then doing the special logic only when false
, use ->ifFalse()
instead
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.
That was my first attempt before doing this, but here's what I get when I try:
Error : Call to undefined method Symfony\Component\Config\Definition\Builder\ExprBuilder::ifFalse()
I could have used ifEmpty()
but I preferred to be strict. WDYT, should I change this or should we add ifFalse()
to the expression builder?
->always() | ||
->then(function ($v) { | ||
if (false === $v) { | ||
trigger_deprecation('symfony/framework-bundle', '6.2', 'Setting the "framework.form.controllers_render_form_views" option to "false" is deprecated. It will have no effect as of Symfony 7.0.'); |
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.
The message should probably be adapted a bit, because it will be confusing when it is not set at all (which will be the case for all existing projects)
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.
You're right, that was a quick copy/past from a previous similar option. Updated, thanks!
src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php
Outdated
Show resolved
Hide resolved
45ca5ed
to
7a491db
Compare
Status: needs review |
7a491db
to
867ae2f
Compare
As this is about a single public method, could we add an optional parameter to that method instead of introducing an option? |
Well, I believe #46854 was about making the API straightforward. A parameter would make it harder to use this feature seamlessly and globally across controllers in the application. |
I get your point, however config is also part of the framework public API. One has to discover and understand that new option. Ensuring that My point is that we should try to avoid complicating the framework configuration with feature-specific settings as much as possible. Not everyone uses |
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 this is unnecessary precautions.
👎 on my side, until a real world issue is reported at least.
#46854 may have introduce a BC break by changing the type of template vars when decorators or templates may expect an instance of
FormInterface
.Before the feature was opt-in by using an explicit method
renderForm()
.Furthermore, this PR improves the feature by handling instances of
FormView
to change the response status code, enabling the same logic without any required changes in user land code.We may want to define the new config option as
true
by default in new projects, I can send a PR onsymfony/recipes
to do so if this one is accepted.