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

[Form] dynamic_form_modification - Update namespace related to EventSubscriber #20464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
  • Loading branch information
nachoaguirre authored and javiereguiluz committed Apr 3, 2025
commit 05ff5258e27fd36bc5fdec0391b6833ab302a4f8
6 changes: 3 additions & 3 deletions 6 form/dynamic_form_modification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ For better reusability or if there is some heavy logic in your event listener,
you can also move the logic for creating the ``name`` field to an
:ref:`event subscriber <event_dispatcher-using-event-subscribers>`::

// src/Form/EventListener/AddNameFieldSubscriber.php
namespace App\Form\EventListener;
// src/Form/EventSubscriber/AddNameFieldSubscriber.php
namespace App\Form\EventSubscriber;

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

// ...
use App\Form\EventListener\AddNameFieldSubscriber;
use App\Form\EventSubscriber\AddNameFieldSubscriber;

class ProductType extends AbstractType
{
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.