小编Mik*_*ról的帖子

Symfony2无法加载类型EntityType

当我尝试在Symfony2表单类型中创建EntityType字段时,我遇到了问题.

这是Symfony2手册中官方EntityType参考的一段代码:

use Symfony\Bridge\Doctrine\Form\Type\EntityType; 

...

$builder->add('users', EntityType::class, array(
        'class' => 'AppBundle:User',
        'choice_label' => 'username',
    ));
Run Code Online (Sandbox Code Playgroud)

回到浏览器我收到Could not load type "Symfony\Bridge\Doctrine\Form\Type\EntityType"错误.

EntityType类存在于给定的namespespace中.

我是否需要为此字段类型获取一些附加扩展名?

php doctrine symfony

1
推荐指数
2
解决办法
9697
查看次数

标签 统计

doctrine ×1

php ×1

symfony ×1