Skip to content

Commit 1d66841

Browse files
authored
Update dynamic_form_modification.rst
Update the namespace of the class to subscribe to events. Currently it points to \EventListener, but I find it more coherent to associate it with \EventSubscriber
1 parent 405f95e commit 1d66841

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

form/dynamic_form_modification.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ For better reusability or if there is some heavy logic in your event listener,
138138
you can also move the logic for creating the ``name`` field to an
139139
:ref:`event subscriber <event_dispatcher-using-event-subscribers>`::
140140

141-
// src/Form/EventListener/AddNameFieldSubscriber.php
142-
namespace App\Form\EventListener;
141+
// src/Form/EventSubscriber/AddNameFieldSubscriber.php
142+
namespace App\Form\EventSubscriber;
143143

144144
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
145145
use Symfony\Component\Form\Extension\Core\Type\TextType;
@@ -172,7 +172,7 @@ Great! Now use that in your form class::
172172
namespace App\Form\Type;
173173

174174
// ...
175-
use App\Form\EventListener\AddNameFieldSubscriber;
175+
use App\Form\EventSubscriber\AddNameFieldSubscriber;
176176

177177
class ProductType extends AbstractType
178178
{

0 commit comments

Comments
 (0)