@@ -91,10 +91,10 @@ might look like the following::
91
91
// src/Acme/DemoBundle/Form/EventListener/AddNameFieldSubscriber.php
92
92
namespace Acme\DemoBundle\Form\EventListener;
93
93
94
- use Symfony\Component\Form\Event\DataEvent;
94
+ use Symfony\Component\Form\FormEvent;
95
+ use Symfony\Component\Form\FormEvents;
95
96
use Symfony\Component\Form\FormFactoryInterface;
96
97
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
97
- use Symfony\Component\Form\FormEvents;
98
98
99
99
class AddNameFieldSubscriber implements EventSubscriberInterface
100
100
{
@@ -145,20 +145,16 @@ The ``FormEvents::PRE_SET_DATA`` line actually resolves to the string ``form.pre
145
145
The `FormEvents class `_ serves an organizational purpose. It is a centralized location
146
146
in which you can find all of the various form events available.
147
147
148
- While this example could have used the ``form.set_data `` event or even the `` form. post_set_data ``
149
- events just as effectively, by using ``form.pre_set_data `` you guarantee that
148
+ While this example could have used the ``form.post_set_data ``
149
+ event just as effectively, by using ``form.pre_set_data `` you guarantee that
150
150
the data being retrieved from the ``Event `` object has in no way been modified
151
- by any other subscribers or listeners. This is because ``form.pre_set_data ``
152
- passes a `DataEvent `_ object instead of the `FilterDataEvent `_ object passed
153
- by the ``form.set_data `` event. `DataEvent `_, unlike its child `FilterDataEvent `_,
154
- lacks a setData() method.
151
+ by any other subscribers or listeners because ``form.pre_set_data `` is the
152
+ first form event dispatched.
155
153
156
154
.. note ::
157
155
158
156
You may view the full list of form events via the `FormEvents class `_,
159
157
found in the form bundle.
160
158
161
- .. _`DataEvent` : https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Event/DataEvent.php
162
159
.. _`FormEvents class` : https://github.com/symfony/Form/blob/master/FormEvents.php
163
160
.. _`Form class` : https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Form.php
164
- .. _`FilterDataEvent` : https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Event/FilterDataEvent.php
0 commit comments