2012-05-16 98 views
0

我想弄清楚FosUserBundle的註冊過程,並且一直無法這樣做。FosUserBundle和自定義用戶註冊

我想能夠使用自定義字段手動註冊用戶,並且無法在代碼中看到該用戶。

我在FosUserBundle的registerAction並按照它的任何地方不給我看信息實際存儲在數據庫中:

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(); 

      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(), 
      'theme' => $this->container->getParameter('fos_user.template.theme'), 
     )); 
    } 

如何手動註冊用戶?

感謝

+1

你甚至想出解決辦法?我有問題,特別是他authenticateUser()函數 – MrGlass

回答