2015-08-08 39 views
3

我在我的網站中使用fosuserbundle進行用戶管理。 它工作正常,但我需要添加「lang」參數給fos路由器以添加多語言支持。 現在的問題是,當嘗試註冊它返回此錯誤:如何將參數傳遞給symfony中的fosuserbundle

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" 

如何傳遞郎參數註冊?????在Mailer.php

回答

2

檢查sendConfirmationEmailMessage功能供應商/ friendsofsymfony /用戶束/郵件程序和Lang參數添加到該功能

+1

我在這行代碼作出變化和通過$ LANG參數起作用'$ URL = $ this-> router-> generate('fos_user_registration_confirm',array('token'=> $ user-> getConfirmationToken(),「lang」=> $ lang),true);' – mgh