当我尝试在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中.
我是否需要为此字段类型获取一些附加扩展名?