2016-01-11 28 views
-1

當我配置FOS用戶捆綁我可以在配置使用別名名稱,如設置自定義表單:fosuserbundle自定義表單配置symfony的2.8

<service id="my.security.type.change.password" class="%my.security.type.change.password.class%"> 
     <argument>%fos_user.model.user.class%</argument> 
     <tag name="form.type" alias="my_change_password" /> 
    </service> 

... 

fos_user: 
    change_password: 
     form: 
      type: my_change_password 

包子走樣的形式配置已經過時了symfony 2.8,所以我」我想知道如何通過symfony 2.8 yaml配置中的名稱來引用fomr。

回答

-1

使用完全合格的類名,例如:

<parameter key="my.security.type.change.password.class">FOS\UserBundle\Form\Type\ChangePasswordFormType</parameter> 

<service id="my.security.type.change.password" class="%my.security.type.change.password.class%"> 
    <argument>%fos_user.model.user.class%</argument> 
    <tag name="form.type" /> 
</service> 

...

fos_user: 
    change_password: 
     form: 
      type: FOS\UserBundle\Form\Type\ChangePasswordFormType 

來源:https://symfony.com/doc/master/bundles/FOSUserBundle/configuration_reference.html爲FOS用戶捆綁2.0分支。

+0

爲了讓您的答案對其他用戶更有用,您可以提供全限定類名的示例並提供指向詳細信息的鏈接。 – hedgesky

相關問題