0

我安装了 PUGXMultiUserBundle。如果我去 /register/member 或 /register/repairer 并提交注册,它总是添加到我的数据库中的新成员。我不明白为什么。但是,当我在 config.yml 中切换用户(第一个是修复者,第二个是成员)时,它是添加到数据库中的修复者。

配置.yml

fos_user:
db_driver: orm
firewall_name: main
user_class: Test\UserBundle\Entity\User
service:
    user_manager: pugx_user_manager

pugx_multi_user:
users:
user_member:
    entity:
      class: Test\UserBundle\Entity\Member
    registration:
      form:
        type: FOS\UserBundle\Form\Type\RegistrationFormType
        name: fos_user_registration_form
        validation_groups:  [Registration, Default]
      template: FOSUserBundle:Registration:register.html.twig
    profile:
      form:
        type: FOS\UserBundle\Form\Type\ProfileFormType
        name: fos_user_profile_form
        validation_groups:  [Profile, Default]
user_repairer:
    entity:
      class: Test\UserBundle\Entity\Repairer
    registration:
      form:
        type: FOS\UserBundle\Form\Type\RegistrationFormType
      template: FOSUserBundle:Registration:register.html.twig
    profile:
      form:
        type: FOS\UserBundle\Form\Type\ProfileFormType

路由.yml

member_registration:
pattern:  /register/member
defaults: { _controller: TestUserBundle:RegistrationMember:register }

repairer_registration:
pattern:  /register/repairer
defaults: { _controller: TestUserBundle:RegistrationRepairer:register }

控制器1

use Symfony\Bundle\FrameworkBundle\Controller\Controller as BaseController;

class RegistrationMemberController extends BaseController
{
public function registerAction()
{
    return $this->container
                ->get('pugx_multi_user.registration_manager')
                ->register('Test\UserBundle\Entity\Member');
}
}

控制器2

use Symfony\Bundle\FrameworkBundle\Controller\Controller as BaseController;

class RegistrationRepairerController extends BaseController
{
public function registerAction()
{
    return $this->container
                ->get('pugx_multi_user.registration_manager')
                ->register('Test\UserBundle\Entity\Repairer');
}
}
4

1 回答 1

0

试试这个分辨率https://github.com/PUGX/PUGXMultiUserBundle/issues/29

希望对你有帮助

于 2013-06-26T16:33:00.893 回答