gpt4 book ai didi

php - Symfony2 : InvalidArgumentException: The service definition "templating.helpers.assets" does not exist

转载 作者:可可西里 更新时间:2023-11-01 12:39:49 25 4
gpt4 key购买 nike

在处理我的 Symfony2 项目时,我(似乎)随机收到错误 InvalidArgumentException: The service definition "templating.helpers.assets"does not exist. 当我转到任何页面时。我试过回到早期的提交,但这并没有改变任何东西。所以它似乎不是我自己的源代码。我也无法 Composer 更新。我已尝试删除缓存、供应商目录和 composer.lock 文件,但我仍然收到此错误:

Loading composer repositories with package information

Updating dependencies (including require-dev)

Generating autoload files

Updating the "app/config/parameters.yml" file

[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
The service definition "templating.helpers.assets" does not exist.

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception

[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.

有什么想法吗?

最佳答案

仅供引用服务 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

它由 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>

所以将这个包添加到您的 appKernel.php

public function registerBundles()
{
$bundles = array(
//Standard
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
//others bundles

关于php - Symfony2 : InvalidArgumentException: The service definition "templating.helpers.assets" does not exist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26239458/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com