-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Form] renderForm()
method is deprecated
#16948
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
[Form] renderForm()
method is deprecated
#16948
Conversation
form/form_customization.rst
Outdated
@@ -21,7 +21,7 @@ enough to render an entire form, including all its fields and error messages: | |||
.. code-block:: twig | |||
|
|||
{# form is a variable passed from the controller via either | |||
$this->renderForm('...', ['form' => $form]) | |||
$this->render('...', ['form' => $form]) | |||
or $this->render('...', ['form' => $form->createView()]) #} |
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.
This line unfortunately won't work the same symfony/symfony#46854 (comment). We need to be careful.
I propose to keep this PR open until I (or anyone) try to tackle this in core.
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.
Yes, I created this PR because currently in 6.2 the renderForm
method is obsolete (so the documentation is acutely wrong). This branch is still under development and can therefore indeed be further modified. If you modify this method, don't forget to ping me so that I can close this PR.
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.
Note that both methods also weren't doing the same thing before this change. So I don't see this change blocking this PR.
forms.rst
Outdated
'form' => $form, | ||
]); | ||
} | ||
} | ||
|
||
In versions prior to Symfony 5.3, controllers used the method | ||
``$this->render('...', ['form' => $form->createView()])`` to render the form. | ||
The ``renderForm()`` method abstracts this logic and it also sets the 422 HTTP | ||
The ``render()`` method abstracts this logic and it also sets the 422 HTTP |
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.
It may not (see my comment above).
Thank you @mdoutreluingne for that PR. |
Just checking: are we still waiting for some code changes before finishing this PR? Thanks! |
Yes, I'll ping when there will be an update :). |
Minor update: I've opened symfony/symfony#47600, let's see how it goes. |
a8a24f6
to
0c39faf
Compare
Thanks @mdoutreluingne for writing up the documentation for this change! I've added some changes to your commit, to be more clear about the current situation and the differences between passing |
Fixes #16942