你使用Symfony 3.3.10和php 7.1。我安装了"jms/di-extra-bundle": "1.7.0"
,之后发生了错误
Call to a member function has() on null
vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php
第356行
我的行动
public function getAdminQuestionAction(ParamFetcher $paramFetcher)
{
try {
$em = $this->getDoctrine();
当我打电话给getDoctrine
后,我有异常
这是我遇到异常的路径
vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php
/**
* Shortcut to return the Doctrine Registry service.
*
* @return Registry
*
* @throws \LogicException If DoctrineBundle is not available
*/
protected function getDoctrine()
{
if (!$this->container->has('doctrine')) {
throw new \LogicException('The DoctrineBundle is not registered in your application.');
}
return $this->container->get('doctrine');
}
我认为安装jms/di-extra-bundle": "1.7.0