jms / di-extra-bundle对成员函数的调用has()为null

时间:2018-02-02 13:46:57

标签: php symfony

你使用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

后容器存在问题

0 个答案:

没有答案