我正在尝试从我的Doctrine实体FieldTypes
加载我的formbuilder选项:
$formBuilder->add('type', EntityType::class, array(
'attr' => array('class' => 'form-control select2'), 'label' => 'Type',
'class' => FieldTypes::class,
));
但是我收到错误消息:
类App \ Controller \ FieldTypes不存在
答案 0 :(得分:1)
您应该在课堂上放一个用途:
namespace App\Controller;
use App\Entity\FieldTypes;
class MyController
{
// ...
public function myAction()
{
// ...
$formBuilder->add('type', EntityType::class, array(
'attr' => array(
'class' => 'form-control select2'
),
'label' => 'Type',
'class' => FieldTypes::class,
));
// ...
}
// ...
}