Symfony 4.3: User Deprecated: The SymfonyBundleTwigBundleLoaderFilesystemLoader class is deprecated since version 4.3 and will be removed in 5.0 …(Symfony 4.3:用户弃用:SymfonyBundleTwigBundleLoaderFilesystemLoader 类自 4.3 版以来已弃用,并将在 5.0 中删除……) - IT屋-程序员软件开发技术分
问题描述
升级到 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
解决方案:
- 从
composer.json
中移除 - 从
framework.yaml
中删除:
"symfony/template"
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 中删除……的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Symfony 4.3:用户弃用:SymfonyBundleTwigBundleLoaderFilesystemLoader 类自 4.3 版以来已弃用,并将在 5.0 中删除……
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- Laravel 仓库 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01