@@ -48,10 +48,12 @@ A) The ``FormEvents::PRE_SET_DATA`` Event
48
48
.........................................
49
49
50
50
The ``FormEvents::PRE_SET_DATA `` event is dispatched at the beginning of the
51
- ``Form::setData() `` method. It can be used to:
52
-
53
- * Modify the data given during pre-population;
54
- * Modify a form depending on the pre-populated data (adding or removing fields dynamically).
51
+ ``Form::setData() `` method. It is used to modify the data given during
52
+ pre-population with
53
+ :method: `FormEvent::setData() <Symfony\\ Component\\ Form\\ FormEvent::setData> `.
54
+ The method :method: `Form::setData() <Symfony\\ Component\\ Form\\ Form::setData> `
55
+ is locked since the event is dispatched from it and will throw an exception
56
+ if called from a listener.
55
57
56
58
=============== ========
57
59
Data Type Value
@@ -66,13 +68,6 @@ View data ``null``
66
68
See all form events at a glance in the
67
69
:ref: `Form Events Information Table <component-form-event-table >`.
68
70
69
- .. caution ::
70
-
71
- During ``FormEvents::PRE_SET_DATA ``,
72
- :method: `Form::setData() <Symfony\\ Component\\ Form\\ Form::setData> `
73
- is locked and will throw an exception if used. If you wish to modify
74
- data, you should use
75
- :method: `FormEvent::setData() <Symfony\\ Component\\ Form\\ FormEvent::setData> `
76
71
instead.
77
72
78
73
.. sidebar :: ``FormEvents::PRE_SET_DATA`` in the Form component
@@ -88,8 +83,8 @@ B) The ``FormEvents::POST_SET_DATA`` Event
88
83
89
84
The ``FormEvents::POST_SET_DATA `` event is dispatched at the end of the
90
85
:method: `Form::setData() <Symfony\\ Component\\ Form\\ Form::setData> `
91
- method. This event is mostly here for reading data after having pre- populated
92
- the form .
86
+ method. This event can be used to modify a form depending on the populated data
87
+ (adding or removing fields dynamically) .
93
88
94
89
=============== ====================================================
95
90
Data Type Value
0 commit comments