FriendsOfSymfony / FOSFacebookBundle

NOT MAINTAINED - see https://github.com/hwi/HWIOAuthBundle
322 stars 140 forks source link

Error on registration #278

Open AxelBriche opened 11 years ago

AxelBriche commented 11 years ago

Hello, on registration, I have this error:

Fatal error: Class 'Kyna\UserBundle\Validator\UsernameValidator' not found in C:\wamp\www\Project_V1\Symfony\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory.php on line 68

ErrorTracer: http://i.imgur.com/mi38NkD.jpg

I have extand the original controller and the namespace is not correct: Kyna\UserBundle\Validator\UsernameValidator, "Kyna\UserBundle" is not correct, it's my namespace and not FosUserBundle namespace.

My registration controller (inspired by example in documentation): <?php

    namespace Kyna\UserBundle\Controller;

    use Symfony\Component\HttpFoundation\RedirectResponse;
    use FOS\UserBundle\Controller\RegistrationController as BaseController;

    class RegistrationController extends BaseController
    {
        public function registerAction()
        {
            $form = $this->container->get('fos_user.registration.form');
            $formHandler = $this->container->get('fos_user.registration.form.handler');
            $confirmationEnabled = $this->container->getParameter('fos_user.registration.confirmation.enabled');

            $process = $formHandler->process($confirmationEnabled);
            if ($process) {
                $user = $form->getData();

                /*****************************************************
                 * Add new functionality (e.g. log the registration) *
                 *****************************************************/

                $this->container->get('logger')->info(
                    sprintf('New user registration: %s', $user)
                );

                if ($confirmationEnabled) {
                    $this->container->get('session')->set('fos_user_send_confirmation_email/email', $user->getEmail());
                    $route = 'fos_user_registration_check_email';
                } else {
                    $this->authenticateUser($user);
                    $route = 'fos_user_registration_confirmed';
                }

                $this->setFlash('fos_user_success', 'registration.flash.user_created');
                $url = $this->container->get('router')->generate($route);

                return new RedirectResponse($url);
            }

            return $this->container->get('templating')->renderResponse('FOSUserBundle:Registration:register.html.'.$this->getEngine(), array(
                'form' => $form->createView(),
            ));
        }
    }

Can you help me please ? Thanks :) ps: sorry for my english, I am french.