Symfony2:InvalidArgumentException:服务定义"templating.helpers.assets"不存在

rya*_*ahn 8 php symfony composer-php

在处理我的Symfony2项目时,我(貌似)InvalidArgumentException: The service definition "templating.helpers.assets" does not exist.在进入任何页面时随机出现错误.我曾尝试回到之前的提交,但这并没有改变任何东西.所以它似乎不是我自己的源代码.我也不能composer update.我已经尝试删除缓存,供应商目录和composer.lock文件,但我仍然收到此错误:

使用包信息加载composer存储库

更新依赖项(包括require-dev)

生成自动加载文件

更新"app/config/parameters.yml"文件

[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
服务定义"templating.helpers.assets"不存在.

脚本Sensio\Bundle\DistributionBundle\Composer\ScriptHandler :: clearCache处理post-update-cmd事件以异常终止

[RuntimeException]
执行"'cache:clear --no-warmup'"命令时发生错误.

有任何想法吗?

bas*_*ien 0

仅供参考服务templating.helper.assets存在

php app/console container:debug  templating.helper.assets 
[container] Information for service templating.helper.assets
Service Id       templating.helper.assets
Class            Symfony\Component\Templating\Helper\CoreAssetsHelper
Tags
    - templating.helper              (alias: assets)
Scope            request
Public           yes
Synthetic        no
Lazy             no
Synchronized     no
Abstract         no
Run Code Online (Sandbox Code Playgroud)

它是由以下创建Symfony\Bundle\FrameworkBundle\FrameworkBundle() 并定义的Resources\config\templating_php.xml

    <service id="templating.helper.assets" class="%templating.helper.assets.class%">
        <tag name="templating.helper" alias="assets" />
        <argument /> <!-- default package -->
        <argument type="collection" /> <!-- named packages -->
    </service>
Run Code Online (Sandbox Code Playgroud)

因此,将此捆绑包添加到您的appKernel.php

public function registerBundles()
{
    $bundles = array(
        //Standard
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        //others bundles
Run Code Online (Sandbox Code Playgroud)