Reputation: 1092
I just started Symfony2 web app project and I'm stuck at a particular problem:
I have users and I have one subscriber to doctrine events (postUpdate and postPersist) to dispatch custom events, so:
Everything goes fine up to that point. What I need to do now is... I need to dispatch 'user.updated_current' if the user modified is current user from within that custom event subscriber (which also subscribes to 'user.updated_current').
Unfortunately 'user.updated_current' event, despite being dispatched, is not handled by my custom event subscriber.
I'm wondering if I actually can dispatch events from within Symfony's event subscriber?
Upvotes: 1
Views: 554
Reputation: 2466
Just inject event_dispatcher
in your subscriber and dispatch your event
Upvotes: 2