如何将一些参数传递给symfony中的fosuserbundle

how to pass some parameter to fosuserbundle in symfony

我在我的网站上使用 fosuserbundle 进行用户管理。 它工作正常,但我需要向 fos 路由器添加 "lang" 参数以添加多语言支持。 现在的问题是当尝试注册它时 returns 这个错误:

Some mandatory parameters are missing ("lang") to generate a URL for route "eartman_designer_registration_confirm".

我的路由器是:

  eartman_designer_security:
        resource: "@EartmanDesignerBundle/Resources/config/routing/security.yml"
        prefix: /designer/{lang}

    eartman_designer_profile:
        resource: "@EartmanDesignerBundle/Resources/config/routing/profile.yml"
        prefix: /designer/{lang}/profile

    eartman_designer_register:
        resource: "@EartmanDesignerBundle/Resources/config/routing/registration.yml"
        prefix: /designer/{lang}/register

    eartman_designer_resetting:
        resource: "@EartmanDesignerBundle/Resources/config/routing/resetting.yml"
        prefix: /designer/resetting

    eartman_designer_change_password:
        resource: "@EartmanDesignerBundle/Resources/config/routing/change_password.yml"
        prefix: /designer/{lang}/profile
    eartman_designer_design:
        resource: "@EartmanDesignerBundle/Resources/config/routing/designer_design.yml"
        prefix: /designer/{lang}/design

注册路由器是:

eartman_designer_registration_register:
    path: /
    defaults: { _controller: "FOSUserBundle:Registration:register" }

eartman_designer_registration_check_email:
    path: /check-email
    defaults: { _controller: "FOSUserBundle:Registration:checkEmail" }
    methods: "GET"

eartman_designer_registration_confirm:
    path: /confirm/{token}
    defaults: { _controller: "FOSUserBundle:Registration:confirm"}
    methods: "GET"

eartman_designer_registration_confirmed:
    path: /confirmed
    defaults: { _controller: "FOSUserBundle:Registration:confirmed" }
    methods: "GET"

注册时如何传lang参数?????

检查vendor/friendsofsymfony/user-bundle/Mailer中Mailer.php中的sendConfirmationEmailMessage函数,并在该函数中添加lang参数