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

Commitc61ddbd

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

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

‎best_practices/forms.rst‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,22 @@ 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+
The ``AbstractController::isFormValid()`` method was added in Symfony 4.3.
223+
224+
It's also possible to use a short-cut if the ``AbstractController`` is imported:
225+
226+
..code-block::php
227+
228+
public function newAction(Request $request)
229+
{
230+
// build the form ...
231+
232+
if ($this->isFormValid($form, $request)) {
233+
// process the form data
234+
}
235+
236+
// render the template
237+
}
238+
221239
Next::doc:`/best_practices/i18n`

‎forms.rst‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,28 @@ 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+
The ``AbstractController::isFormValid()`` method was added in Symfony 4.3.
270+
271+
272+
It's also possible to use a short-cut if the ``AbstractController`` is imported:
273+
274+
275+
..code-block::php
276+
277+
public function newAction(Request $request)
278+
{
279+
// build the form ...
280+
281+
if ($this->isFormValid($form, $request)) {
282+
// process the form data
283+
}
284+
285+
// render the template
286+
}
287+
288+
267289
This controller follows a common pattern for handling forms and has three
268290
possible paths:
269291

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp