Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 35c408c

Browse filesBrowse 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
Copy full SHA for 35c408c

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed

‎form/dynamic_form_modification.rst

Copy file name to clipboardExpand all lines: form/dynamic_form_modification.rst
+3-3Lines changed: 3 additions & 3 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.