无法加载“my_form”类型symfony3

时间:2015-12-21 11:41:09

标签: symfony

升级到Symfony3后,我的表单不再起作用了。我目前收到的消息是:

Could not load type "my_entity_form"

表单在MyBundle / Resources / config / form.xml中定义为服务,并通过依赖注入加载。捆绑包已注册,文件似乎正确加载。

以下是定义为服务的表单:

<!-- MyEntity FormType -->
<service id="form.type.my_entity" class="MyVendor\MyBundle\Form\Type\MyEntityType">
  <tag name="form.type" alias="my_entity_form"/>
</service>

这是我的表单类型

namespace MyVender\MyBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class MyEntityType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add(...));
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'MyVender\MyBundle\Entity\MyEntity'
        ));
    }

    public function getName()
    {
        return 'my_entity_form';
    }

}

任何人都知道问题可能是什么?

0 个答案:

没有答案