Skip to content

Commit cfa7597

Browse files
committed
minor #16925 Add getter and setter in the section on basic form options (mpdude)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- Add `getter` and `setter` in the section on basic form options `getter` and `setter` were first documented in #14241, but only on the subpage on Data Mappers. I usually check the general Form Options page when I look for a feature like this, so my suggestion is to mention it there as well. Commits ------- be84b5d Add `getter` and `setter` in the section on basic form options
2 parents cc59a66 + be84b5d commit cfa7597

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

reference/forms/types/form.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ The actual default value of this option depends on other field options:
7676

7777
.. include:: /reference/forms/types/options/form_attr.rst.inc
7878

79+
``getter``
80+
~~~~~~~~~~
81+
82+
**type**: ``callable`` **default**: ``null``
83+
84+
When provided, this callable will be invoked to read the value from
85+
the underlying object that will be used to populate the form field.
86+
87+
More details are available in the section on :doc:`/form/data_mappers`.
88+
89+
.. versionadded:: 5.2
90+
91+
Form mapping callbacks were added in Symfony 5.2.
92+
7993
.. include:: /reference/forms/types/options/help.rst.inc
8094

8195
.. include:: /reference/forms/types/options/help_attr.rst.inc
@@ -112,6 +126,20 @@ The actual default value of this option depends on other field options:
112126

113127
.. include:: /reference/forms/types/options/required.rst.inc
114128

129+
``setter``
130+
~~~~~~~~~~
131+
132+
**type**: ``callable`` **default**: ``null``
133+
134+
When provided, this callable will be invoked to map the form value
135+
back to the underlying object.
136+
137+
More details are available in the section on :doc:`/form/data_mappers`.
138+
139+
.. versionadded:: 5.2
140+
141+
Form mapping callbacks were added in Symfony 5.2.
142+
115143
.. include:: /reference/forms/types/options/trim.rst.inc
116144

117145
.. include:: /reference/forms/types/options/validation_groups.rst.inc

0 commit comments

Comments
 (0)