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

Commit25c67c7

Browse files
committed
documenting choice_lazy option
1 parent52d4f7b commit25c67c7

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

‎reference/forms/types/choice.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ correct types will be assigned to the model.
178178

179179
..include::/reference/forms/types/options/choice_loader.rst.inc
180180

181+
..include::/reference/forms/types/options/choice_lazy.rst.inc
182+
181183
..include::/reference/forms/types/options/choice_name.rst.inc
182184

183185
..include::/reference/forms/types/options/choice_translation_domain_enabled.rst.inc
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
``choice_lazy``
2+
~~~~~~~~~~~~~~~
3+
4+
**type**: ``boolean`` **default**: ``false``
5+
6+
The ``choice_lazy`` option is especially useful when dealing with a large set of
7+
choices, where loading all of them at once could lead to performance issues or
8+
significant delays::
9+
10+
use App\Entity\User;
11+
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
12+
13+
$builder->add('user', EntityType::class, [
14+
'class' => User::class,
15+
'choice_lazy' => true,
16+
]);
17+
18+
When set to ``true``, and used in combination with the ``choice_loader`` option,
19+
the form will only load and render the choices that are preset as default values
20+
or submitted. This allows you to defer loading the full list of choices and can
21+
improve the performance of your form.
22+
23+
.. caution::
24+
25+
Please note that when using ``choice_lazy``, you are responsible for providing
26+
the user interface to select choices, typically through a JavaScript plugin that
27+
can handle the dynamic loading of choices.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp