【发布时间】:2020-05-29 06:33:48
【问题描述】:
尝试使用数据转换器,加载我的 html 表单时出错
在我的 formType 类中
use Doctrine\ORM\EntityManagerInterface;
class PmpType extends AbstractType
{
private $entityManager;
public function __construct(EntityManagerInterface $entityManager)
{
$this->entityManager = $entityManager;
}
}
在我的 app\config\services.yml 中
services:
# default configuration for services in *this* file
_defaults:
# automatically injects dependencies in your services
autowire: true
# automatically registers your services as commands, event subscribers, etc.
autoconfigure: true
# this means you cannot fetch services directly from the container via $container->get()
# if you need to do this, you can override this setting on individual services
public: true
但是我收到了这个错误
Type error: Too few arguments to function myApp\Bundle\Form\PmpType::__construct(), 0 passed in \vendor\symfony\symfony\src\Symfony\Component\Form\FormRegistry.php on line 92 and exactly 1 expected
我错过了什么
谢谢你
【问题讨论】: