Symfony 4.3:用户弃用:SymfonyBundleTwigBundleLoaderFilesystemLoader 类自 4.3 版以来已弃用,并将在 5.0 中删除…… [英] Symfony 4.3: User Deprecated: The SymfonyBundleTwigBundleLoaderFilesystemLoader class is deprecated since version 4.3 and will be removed in 5.0 …

查看:23
本文介绍了Symfony 4.3:用户弃用:SymfonyBundleTwigBundleLoaderFilesystemLoader 类自 4.3 版以来已弃用,并将在 5.0 中删除……的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到 Symfony 4.3 后,我收到以下 22 条弃用警告:

After upgrading to Symfony 4.3, I'm getting the following 22 deprecation warnings:

用户弃用:SymfonyBundleTwigBundleLoaderFilesystemLoader 类自 4.3 版以来已弃用,将在 5.0 中删除;对模板使用 Twig 表示法.

User Deprecated: The SymfonyBundleTwigBundleLoaderFilesystemLoader class is deprecated since version 4.3 and will be removed in 5.0; use Twig notation for templates instead.

用户已弃用:templating.locator" 服务自 Symfony 4.3 起已弃用,并将在 5.0 中删除.

User Deprecated: The "templating.locator" service is deprecated since Symfony 4.3 and will be removed in 5.0.

用户弃用:SymfonyBundleFrameworkBundleTemplatingLoaderTemplateLocator 类自 4.3 版以来已弃用,并将在 5.0 中删除;改用 Twig.

User Deprecated: The SymfonyBundleFrameworkBundleTemplatingLoaderTemplateLocator class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.

用户已弃用:templating.name_parser" 服务自 Symfony 4.3 起已弃用,并将在 5.0 中删除.

User Deprecated: The "templating.name_parser" service is deprecated since Symfony 4.3 and will be removed in 5.0.

用户弃用:SymfonyBundleFrameworkBundleTemplatingTemplateNameParser 类自 4.3 版以来已弃用,将在 5.0 中删除;改用 Twig.

User Deprecated: The SymfonyBundleFrameworkBundleTemplatingTemplateNameParser class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.

用户已弃用:使用 模板" 服务自 4.3 版起已弃用,并将在 5.0 中删除;改用 Twig.

User Deprecated: Using the "templating" service is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.

用户已弃用:SymfonyBridgeTwigTwigEngine 类自 4.3 版以来已弃用,并将在 5.0 中删除;请改用 TwigEnvironment.

User Deprecated: The SymfonyBridgeTwigTwigEngine class is deprecated since version 4.3 and will be removed in 5.0; use TwigEnvironment instead.

用户弃用:SymfonyBundleFrameworkBundleTemplatingEngineInterface 接口自 4.3 版以来已弃用,将在 5.0 中删除;改用 Twig.

User Deprecated: The SymfonyBundleFrameworkBundleTemplatingEngineInterface interface is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.

用户已弃用:SymfonyBundleTwigBundleTwigEngine 类自 4.3 版以来已弃用,并将在 5.0 中删除;请改用 TwigEnvironment.

User Deprecated: The SymfonyBundleTwigBundleTwigEngine class is deprecated since version 4.3 and will be removed in 5.0; use TwigEnvironment instead.

2 次:framework.template" 配置自 Symfony 4.3 起已被弃用.改为配置 Twig Bundle 提供的 twig" 部分.

2 times: The "framework.templating" configuration is deprecated since Symfony 4.3. Configure the "twig" section provided by the Twig Bundle instead.

自 4.3 版起已弃用启用模板组件,并将在 5.0 版中删除;改用 Twig.

Enabling the Templating component is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.

templating.cache_warmer.template_paths" 服务自 Symfony 4.3 起已弃用,并将在 5.0 中删除.

The "templating.cache_warmer.template_paths" service is deprecated since Symfony 4.3 and will be removed in 5.0.

SymfonyBundleFrameworkBundleCacheWarmerTemplatePathsCacheWarmer 类自 4.3 版起已弃用,并将在 5.0 版中删除;改用 Twig.

The SymfonyBundleFrameworkBundleCacheWarmerTemplatePathsCacheWarmer class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.

templating.finder" 服务自 Symfony 4.3 起已弃用,并将在 5.0 中删除.

The "templating.finder" service is deprecated since Symfony 4.3 and will be removed in 5.0.

SymfonyBundleFrameworkBundleCacheWarmerTemplateFinder 类自 4.3 版起已弃用,将在 5.0 版中删除;改用 Twig.

The SymfonyBundleFrameworkBundleCacheWarmerTemplateFinder class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.

SymfonyBundleFrameworkBundleCacheWarmerTemplateFinderInterface 接口自 4.3 版本起已弃用,并将在 5.0 中删除;改用 Twig.

The SymfonyBundleFrameworkBundleCacheWarmerTemplateFinderInterface interface is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.

templating.locator" 服务自 Symfony 4.3 起已弃用,并将在 5.0 中删除.

The "templating.locator" service is deprecated since Symfony 4.3 and will be removed in 5.0.

SymfonyBundleFrameworkBundleTemplatingLoaderTemplateLocator 类自 4.3 版起已弃用,将在 5.0 中删除;改用 Twig.

The SymfonyBundleFrameworkBundleTemplatingLoaderTemplateLocator class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.

SymfonyBundleFrameworkBundleTemplatingTemplateReference 类自 4.3 版起已弃用,并将在 5.0 版中删除;改用 Twig.

The SymfonyBundleFrameworkBundleTemplatingTemplateReference class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.

templating.name_parser" 服务自 Symfony 4.3 起已弃用,并将在 5.0 中删除.

The "templating.name_parser" service is deprecated since Symfony 4.3 and will be removed in 5.0.

SymfonyBundleFrameworkBundleTemplatingTemplateNameParser 类自 4.3 版起已弃用,将在 5.0 中删除;改用 Twig.

The SymfonyBundleFrameworkBundleTemplatingTemplateNameParser class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.

推荐答案

这是由于模板组件的弃用,请参阅 https://symfony.com/blog/new-in-symfony-4-3-deprecated-the-template-component-integration

This is due to the deprecation of the templating component, see https://symfony.com/blog/new-in-symfony-4-3-deprecated-the-templating-component-integration

解决方案:

  1. composer.json
  2. 中移除 "symfony/template"
  3. framework.yaml 中删除:
templating:
    engines:
        - twig

  • 运行 composer 更新
  • 这应该会删除所有弃用警告.

    This should remove all the deprecation warnings.

    如果您收到此错误

    无法自动装配服务...":方法__construct()"的参数$templating"引用了接口SymfonyBundleFrameworkBundleTemplatingEngineInterface",但不存在此类服务.您是否创建了实现此接口的类?

    Cannot autowire service "...": argument "$templating" of method "__construct()" references interface "SymfonyBundleFrameworkBundleTemplatingEngineInterface" but no such service exists. Did you create a class that implements this interface?

    ...您仍在某些服务中使用旧模板.
    解决方法:将依赖从SymfonyBundleFrameworkBundleTemplatingEngineInterface改为TwigEnvironment:

    ... you're still using the old templating in some service.
    Solution: Change the dependency from SymfonyBundleFrameworkBundleTemplatingEngineInterface to TwigEnvironment:

    use TwigEnvironment;
    
    private $twig;
    
    public function __construct(Environment $twig)
    {
        $this->twig = $twig;
    }
    

    另见 https://github.com/symfony/symfony/issues/31645

    这篇关于Symfony 4.3:用户弃用:SymfonyBundleTwigBundleLoaderFilesystemLoader 类自 4.3 版以来已弃用,并将在 5.0 中删除……的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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