|
16 | 16 | final class FormEvents
|
17 | 17 | {
|
18 | 18 | /**
|
| 19 | + * The PRE_SUBMIT event is dispatched at the beginning of the Form::submit() method. |
| 20 | + * |
| 21 | + * It can be used to: |
| 22 | + * - Change data from the request, before submitting the data to the form. |
| 23 | + * - Add or remove form fields, before submitting the data to the form. |
| 24 | + * The event listener method receives a Symfony\Component\Form\FormEvent instance. |
| 25 | + * |
19 | 26 | * @Event
|
20 | 27 | */
|
21 | 28 | const PRE_SUBMIT = 'form.pre_bind';
|
22 | 29 |
|
23 | 30 | /**
|
| 31 | + * The SUBMIT event is dispatched just before the Form::submit() method |
| 32 | + * transforms back the normalized data to the model and view data. |
| 33 | + * |
| 34 | + * It can be used to change data from the normalized representation of the data. |
| 35 | + * The event listener method receives a Symfony\Component\Form\FormEvent instance. |
| 36 | + * |
24 | 37 | * @Event
|
25 | 38 | */
|
26 | 39 | const SUBMIT = 'form.bind';
|
27 | 40 |
|
28 | 41 | /**
|
| 42 | + * The FormEvents::POST_SUBMIT event is dispatched after the Form::submit() |
| 43 | + * once the model and view data have been denormalized. |
| 44 | + * |
| 45 | + * It can be used to fetch data after denormalization. |
| 46 | + * The event listener method receives a Symfony\Component\Form\FormEvent instance. |
| 47 | + * |
29 | 48 | * @Event
|
30 | 49 | */
|
31 | 50 | const POST_SUBMIT = 'form.post_bind';
|
32 | 51 |
|
33 | 52 | /**
|
| 53 | + * The FormEvents::PRE_SET_DATA event is dispatched at the beginning of the Form::setData() method. |
| 54 | + * |
| 55 | + * It can be used to: |
| 56 | + * - Modify the data given during pre-population; |
| 57 | + * - Modify a form depending on the pre-populated data (adding or removing fields dynamically). |
| 58 | + * The event listener method receives a Symfony\Component\Form\FormEvent instance. |
| 59 | + * |
34 | 60 | * @Event
|
35 | 61 | */
|
36 | 62 | const PRE_SET_DATA = 'form.pre_set_data';
|
37 | 63 |
|
38 | 64 | /**
|
| 65 | + * The FormEvents::POST_SET_DATA event is dispatched at the end of the Form::setData() method. |
| 66 | + * |
| 67 | + * This event is mostly here for reading data after having pre-populated the form. |
| 68 | + * The event listener method receives a Symfony\Component\Form\FormEvent instance. |
| 69 | + * |
39 | 70 | * @Event
|
40 | 71 | */
|
41 | 72 | const POST_SET_DATA = 'form.post_set_data';
|
|
0 commit comments