Skip to content

Commit 35c408c

Browse files
committed
minor #20464 [Form] dynamic_form_modification - Update namespace related to EventSubscriber (nachoaguirre)
This PR was submitted for the 7.2 branch but it was merged into the 6.4 branch instead. Discussion ---------- [Form] dynamic_form_modification - Update namespace related to EventSubscriber 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. Link: https://symfony.com/doc/current/form/dynamic_form_modification.html#adding-an-event-subscriber-to-a-form-class From: <img width="612" alt="image" src="https://github.com/user-attachments/assets/aef1ef30-0fbf-4c5a-9b32-1fb4217e1ae0"> To: <img width="612" alt="image" src="https://github.com/user-attachments/assets/9e7ab86c-d6fe-4a18-863d-dbc4329b38ae"> Commits ------- 05ff525 Update dynamic_form_modification.rst
2 parents 5e6d3b0 + 05ff525 commit 35c408c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: 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)