1

当我运行命令时,将 Symfony 的最新版本从 3.0.2 更新到 3.1.2 后。

php bin/console cache:clear --env=prod

我现在收到以下错误:

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] 服务“分析器”依赖于不存在的服务“debug.security.access.decision_manager”。

有谁知道为什么会发生这种情况,或者我能做些什么来解决这个问题?我可以根据需要添加任何其他信息。提前致谢!!!

4

1 回答 1

1

这个问题与我在生产环境中包含调试资源的事实有关。我正在对缓存机制进行测试,忘记从 config.yml 和 AppKernel.php 文件中删除包含。

        if (in_array($this->getEnvironment(), ['dev','test','prod'], true)) {
            $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
            //... Extensions From Base
            $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
    }

因此,AppKernel 实例化需要将调试参数设置为 true。

$kernel = new AppKernel('prod', true);

否则它会导致我问这个问题要解决的最初问题。

于 2016-07-11T21:33:36.440 回答