public function sendConfirmationEmail(FormEvent $event)
    {
        /** @var UserInterface $user */
        $user = $event->getForm()->getData();

        $user->setEnabled(false);
        if (null === $user->getConfirmationToken()) {
            $user->setConfirmationToken($this->generateToken());
        }

        $this->mailer->sendConfirmationEmailMessage($user);

        $this->session->set('silex_user_confirmation_email', $user->getEmail());

        $event->setResponse(new RedirectResponse($this->router->generate('silex_user.registration_check_email')));
    }
public function sendConfirmationEmail(FormEvent $event)
    {
        /** @var UserInterface $user */
        $user = $event->getForm()->getData();

        $user->setEnabled(false);
        if (null === $user->getConfirmationToken()) {
            $user->setConfirmationToken($this->generateToken());
        }

        $this->mailer->sendConfirmationEmailMessage($user);

        $this->session->set('silex_user_confirmation_email', $user->getEmail());

        $event->setResponse(new RedirectResponse($this->router->generate('silex_user.registration_check_email')));
    }
public function sendConfirmationEmail ( FormEvent $ event ) { /** @var UserInterface $user */ $ user = $ event -> getForm ( ) -> getData ( ) ; $ user -> setEnabled ( false ) ; if ( null === $ user -> getConfirmationToken ( ) ) { $ user -> setConfirmationToken ( $ this -> generateToken ( ) ) ; } $ this -> mailer -> sendConfirmationEmailMessage ( $ user ) ; $ this -> session -> set ( 'silex_user_confirmation_email' , $ user -> getEmail ( ) ) ; $ event -> setResponse ( new RedirectResponse ( $ this -> router -> generate ( 'silex_user.registration_check_email' ) ) ) ; }
Sends an email to the user to activate his account.

@param FormEvent $event
Sends an email to the user to activate his account .