【问题标题】:Symfony 3.1.2 "The service 'profiler' has a dependency on a non-existent service 'debug.security.access.decision_manager'."Symfony 3.1.2 “服务 'profiler' 依赖于不存在的服务 'debug.security.access.decision_manager'。”
【发布时间】:2016-07-11 20:46:45
【问题描述】:

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

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

我现在收到以下错误:

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

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

【问题讨论】:

    标签: php model-view-controller symfony-3.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);
    

    否则会导致我提出这个问题来解决的最初问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-10
      • 1970-01-01
      • 2017-03-21
      • 2019-09-28
      • 2015-05-29
      • 2018-07-22
      • 2019-07-08
      相关资源
      最近更新 更多