Controller/SecurityController.php
public function registerConfirm(\Swift_Mailer $mailer, EventDispatcherInterface $dispatcher, TranslatorInterface $translator, $token)
    {
        // Get Doctrine
        $em = $this->getDoctrine()->getManager();

        // Find User
        $user = $em->getRepository($this->getParameter('pd_user.user_class'))->findOneBy(['confirmationToken' => $token]);
        if (null === $user) {
            throw $this->createNotFoundException(sprintf($translator->trans('security.token_notfound'), $token));
        }

        // Enabled User
        $user->setConfirmationToken(null);
        $user->setEnabled(true);

        // Send Welcome
        if ($this->getParameter('pd_user.welcome_email')) {
            $this->sendEmail($user, $mailer, 'Registration', 'Welcome', 'Welcome');
        }

        // Update User
        $em->persist($user);
        $em->flush();

        // Dispatch Register Event
        if ($response = $dispatcher->dispatch(UserEvent::REGISTER_CONFIRM, new UserEvent($user))->getResponse()) {
            return $response;
        }

        // Register Success
        return $this->render($this->getParameter('pd_user.template_path') . '/Registration/registerSuccess.html.twig', [
            'user' => $user,
        ]);
    }
public function registerConfirm(\Swift_Mailer $mailer, EventDispatcherInterface $dispatcher, TranslatorInterface $translator, $token)
    {
        // Get Doctrine
        $em = $this->getDoctrine()->getManager();

        // Find User
        $user = $em->getRepository($this->getParameter('pd_user.user_class'))->findOneBy(['confirmationToken' => $token]);
        if (null === $user) {
            throw $this->createNotFoundException(sprintf($translator->trans('security.token_notfound'), $token));
        }

        // Enabled User
        $user->setConfirmationToken(null);
        $user->setEnabled(true);

        // Send Welcome
        if ($this->getParameter('pd_user.welcome_email')) {
            $this->sendEmail($user, $mailer, 'Registration', 'Welcome', 'Welcome');
        }

        // Update User
        $em->persist($user);
        $em->flush();

        // Dispatch Register Event
        if ($response = $dispatcher->dispatch(UserEvent::REGISTER_CONFIRM, new UserEvent($user))->getResponse()) {
            return $response;
        }

        // Register Success
        return $this->render($this->getParameter('pd_user.template_path') . '/Registration/registerSuccess.html.twig', [
            'user' => $user,
        ]);
    }
public function registerConfirm ( \ Swift_Mailer $ mailer , EventDispatcherInterface $ dispatcher , TranslatorInterface $ translator , $ token ) { // Get Doctrine $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; // Find User $ user = $ em -> getRepository ( $ this -> getParameter ( 'pd_user.user_class' ) ) -> findOneBy ( [ 'confirmationToken' => $ token ] ) ; if ( null === $ user ) { throw $ this -> createNotFoundException ( sprintf ( $ translator -> trans ( 'security.token_notfound' ) , $ token ) ) ; } // Enabled User $ user -> setConfirmationToken ( null ) ; $ user -> setEnabled ( true ) ; // Send Welcome if ( $ this -> getParameter ( 'pd_user.welcome_email' ) ) { $ this -> sendEmail ( $ user , $ mailer , 'Registration' , 'Welcome' , 'Welcome' ) ; } // Update User $ em -> persist ( $ user ) ; $ em -> flush ( ) ; // Dispatch Register Event if ( $ response = $ dispatcher -> dispatch ( UserEvent :: REGISTER_CONFIRM , new UserEvent ( $ user ) ) -> getResponse ( ) ) { return $ response ; } // Register Success return $ this -> render ( $ this -> getParameter ( 'pd_user.template_path' ) . '/Registration/registerSuccess.html.twig' , [ 'user' => $ user , ] ) ; }
Registration Confirm Token.

@param $token

@return \Symfony\Component\HttpFoundation\Response
Registration Confirm Token .