Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7415ef9

Browse files
committed
[FrameworkBundle] Added doc for ControllerTrait::isFormValid
1 parent9c1f0a3 commit7415ef9

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

‎best_practices/forms.rst‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,21 @@ handling the form submit. For example, you *could* have a ``new()`` action that
218218
submit. Both those actions will be almost identical. So it's much simpler to let
219219
``new()`` handle everything.
220220

221+
..versionadded::4.3
222+
223+
The ``AbstractController::isFormValid()`` method was added in Symfony 4.3.
224+
225+
It's also possible to use a short-cut if the ``AbstractController`` is extended::
226+
227+
public function new(Request $request)
228+
{
229+
// build the form ...
230+
231+
if ($this->isFormValid($form, $request)) {
232+
// process the form data
233+
}
234+
235+
// render the template
236+
}
237+
221238
Next::doc:`/best_practices/i18n`

‎forms.rst‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,25 @@ your controller::
264264
is called. Otherwise, changes done in the ``*_SUBMIT`` events aren't applied to the
265265
view (like validation errors).
266266

267+
268+
..versionadded::4.3
269+
270+
The ``AbstractController::isFormValid()`` method was added in Symfony 4.3.
271+
272+
It's also possible to use a short-cut if the ``AbstractController`` is extended::
273+
274+
public function new(Request $request)
275+
{
276+
// build the form ...
277+
278+
if ($this->isFormValid($form, $request)) {
279+
// process the form data
280+
}
281+
282+
// render the template
283+
}
284+
285+
267286
This controller follows a common pattern for handling forms and has three
268287
possible paths:
269288

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp