FOSUserBundle icon indicating copy to clipboard operation
FOSUserBundle copied to clipboard

Using user manager to create user doesn't trigger registration related events

Open paul999 opened this issue 10 years ago • 2 comments

Hi,

Due reason I can't use the default form implementation for creating users, so I used createUser and updateUser in the user manager. However, when using this, the different events regarding registration aren't triggered, while important configuration items (Like confirmation mails) depend on these events.

For now I copied the code from the registrationController, but this doesn't sound like the best solution.

paul999 avatar Dec 31 '14 17:12 paul999

Hi, I ran into this issue as well. Any way to trigger the events from fixtures ? ( this event depends on Request and Response )

vamsiikrishna avatar May 21 '15 07:05 vamsiikrishna

I know this is very old but in an effort to help others and close this issue...

Inject Symfony\Component\EventDispatcher\EventDispatcherInterface into your class.

Then trigger the event. $this->dispatcher->dispatch(FOSUserEvents::USER_CREATED, new UserEvent($user, new Request()));

silverbackdan avatar Jul 04 '18 16:07 silverbackdan