Symfony2: Could not load type “MyType”

后端 未结 1 1670
慢半拍i
慢半拍i 2021-02-12 09:52

I am trying to create a new field type and add it to a form class in Symfony 2.

I have created a class called MyType (for testing purpose) and when I want t

相关标签:
1条回答
  • 2021-02-12 10:14

    You have register your form in the section services of your config.yml

    services:
       my_type_form:
          class: sf\MyTypeBundle\Form\MyType
          tags:
             -  { name: form.type }
    

    Then you can call it from your controller with the name "my_type_form".

    0 讨论(0)
提交回复
热议问题