找不到服务sensio_distribution.webconfigurator [英] Service sensio_distribution.webconfigurator no found

查看:52
本文介绍了找不到服务sensio_distribution.webconfigurator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从事Symfony2.4项目的工作,我决定进入生产环境,但是在清空缓存生产时,出现了此错误:

I work on a Symfony2.4 project and I decided to go into production environment but when emptying the cache production I got this error :


[Symfony\组件\DependencyInjection\Exception\ServiceNotFoundException]
您已请求不存在的服务
sensio_distribution.webconfigurator。

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] You have requested a non-existent service "sensio_distribution.webconfigurator".

我不知道何时使用此服务,但我搜索了文件 webconfigurator.xml,然后发现了名为 sensio_distribution.webconfigurator的服务...
文件路径如下:

I don't know when this service is used but I searched the file "webconfigurator.xml" and I have found the service called "sensio_distribution.webconfigurator"... The file path is the following :


vendor / sensio / Bundle / DIstributionBundle / Resources / config / webconfigurator.xml

vendor/sensio/Bundle/DIstributionBundle/Resources/config/webconfigurator.xml

这是文件:

<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <parameters>
        <parameter key="sensio_distribution.webconfigurator.class">Sensio\Bundle\DistributionBundle\Configurator\Configurator</parameter>
    </parameters>

    <services>
        <service id="sensio_distribution.webconfigurator" class="%sensio_distribution.webconfigurator.class%">
            <argument>%kernel.root_dir%</argument>
        </service>

        <!-- deprecated, kept for BC -->
        <service id="sensio.distribution.webconfigurator" alias="sensio_distribution.webconfigurator" />
    </services>
</container>

那么为什么会有这个错误?

So why do I have this error?

编辑: sensio分发包已加载到AppKernel.php中

the sensio distribution bundle is loaded in AppKernel.php

if (in_array($this->getEnvironment(), array('prod', 'dev', 'test'))) {
            $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }


推荐答案

我找到了我的错误:

我不得不将捆绑包Acme移至 if条件之外,并删除了 prod:

I had to move my bundle Acme outside the "if" condition, removing "prod" in :

if(in_array($ this-> getEnvironment(),array('prod','dev','test')))

且有效:)

这篇关于找不到服务sensio_distribution.webconfigurator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆