[英]FosUserBundle and custom user registration
I am trying to figure out the registration process of the FosUserBundle and have been unable to do so. 我试图弄清楚FosUserBundle的注册过程,但一直无法做到。
I want to be able to register a user manually using custom fields and have been unable to see that in the code. 我希望能够使用自定义字段手动注册用户,并且无法在代码中看到该用户。
I have the registerAction in FosUserBundle and following it anywhere does not show me where the information is actually stored in the database: 我在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'),
));
}
How do I register a user manually? 如何手动注册用户?
Thanks 谢谢
Have you read this in the FOSUserBundle docs? 你有没有在FOSUserBundle文档中读到这个?
Using the UserManager 使用UserManager
Apparently the service UserManager has the responsibility to actually save and update the user, you could create your own UserManager by following the guide. 显然,服务UserManager有责任实际保存和更新用户,您可以按照指南创建自己的UserManager。
Edit: Symfony has incorporated the documentation for the FOSUserBundle into their own documentation, as so the new link for the documentation is: https://symfony.com/doc/master/bundles/FOSUserBundle/index.html 编辑:Symfony已将FOSUserBundle的文档合并到他们自己的文档中,因此文档的新链接是: https ://symfony.com/doc/master/bundles/FOSUserBundle/index.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.