我在symfony项目上工作,我安装了sonata admin和sonata用户包。 我会在注册后向用户发送确认邮件,但我发现了这个问题:
Unable to generate a URL for the named route "fos_user_registration_confirm" as such route does not exist.
这是我在控制器中的功能
> /**
> * @param $data
> * @return \FOS\UserBundle\Model\UserInterface
> */
> private function createUser($data)
> {
> $userManager = $this->get('fos_user.user_manager');
> $user = $userManager->createUser();
> $user->setUsername($this->getUsername($data['firstname'] . $data['lastname']));
> $user->setEmail($data['email']);
> $user->setEnabled(false);
> $user->addRole("role_fo_user");
> $user->setConfirmationToken($this->container->get('fos_user.util.token_generator')->generateToken());
> $user->setPlainPassword($data['password']);
> $userManager->updateUser($user);
> $this->container->get('fos_user.mailer')->sendConfirmationEmailMessage($user);
> return $user;
> }
这是我的fos配置:
fos_user:
db_driver: orm # can be orm or odm
firewall_name: main
user_class: Application\Sonata\UserBundle\Entity\User
group:
group_class: Sonata\UserBundle\Entity\BaseGroup
group_manager: sonata.user.orm.group_manager # If you're using doctrine orm (use sonata.user.mongodb.group_manager for mongodb)
service:
user_manager: sonata.user.orm.user_manager # If you're using doctrine orm (use sonata.user.mongodb.user_manager for mongodb)
registration:
form:
type: minn_user_registration
confirmation:
enabled: true
template: MinnUserBundle:Registration:email.txt.twig
from_email:
address: xxxxx@xxxx.com
sender_name: xxxx
service:
mailer: fos_user.mailer.twig_swift
我不知道我应该导入的问题或缺失的路线在哪里! 请帮忙!