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 中删除……
基础教程推荐
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 在多维数组中查找最大值 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01