Skip to content

Commit 23e0bc3

Browse files
committed
Merge branch '6.3' into 6.4
* 6.3: [Form] Added `AbstractChoiceLoader`
2 parents b2edf48 + 6ff0a80 commit 23e0bc3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

reference/forms/types/options/choice_loader.rst.inc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ This will cause the call of ``StaticClass::getConstants()`` to not happen if the
2626
request is redirected and if there is no pre set or submitted data. Otherwise
2727
the choice options would need to be resolved thus triggering the callback.
2828

29+
If the built-in ``CallbackChoiceLoader`` doesn't fit your needs, you can create
30+
your own loader by implementing the
31+
:class:`Symfony\\Component\\Form\\ChoiceList\\Loader\\ChoiceLoaderInterface`
32+
or by extending the
33+
:class:`Symfony\\Component\\Form\\ChoiceList\\Loader\\AbstractChoiceLoader`.
34+
This abstract class saves you some boilerplate by implementing some methods of
35+
the interface so you'll only have to implement the
36+
:method:`Symfony\\Component\\Form\\ChoiceList\\Loader\\AbstractChoiceLoader::loadChoices`
37+
method to have a fully functional choice loader.
38+
39+
.. versionadded:: 5.1
40+
41+
The :class:`Symfony\\Component\\Form\\ChoiceList\\Loader\\AbstractChoiceLoader`
42+
class was introduced in Symfony 5.1.
43+
2944
When you're defining a custom choice type that may be reused in many fields
3045
(like entries of a collection) or reused in multiple forms at once, you
3146
should use the :class:`Symfony\\Component\\Form\\ChoiceList\\ChoiceList`

0 commit comments

Comments
 (0)