- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
升级到 Symfony 4.3 后,我收到以下 22 条弃用警告:
User Deprecated: The Symfony\Bundle\TwigBundle\Loader\FilesystemLoader class is deprecated since version 4.3 and will be removed in 5.0; use Twig notation for templates instead.
User Deprecated: The "templating.locator" service is deprecated since Symfony 4.3 and will be removed in 5.0.
User Deprecated: The Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
User Deprecated: The "templating.name_parser" service is deprecated since Symfony 4.3 and will be removed in 5.0.
User Deprecated: The Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
User Deprecated: Using the "templating" service is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
User Deprecated: The Symfony\Bridge\Twig\TwigEngine class is deprecated since version 4.3 and will be removed in 5.0; use \Twig\Environment instead.
User Deprecated: The Symfony\Bundle\FrameworkBundle\Templating\EngineInterface interface is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
User Deprecated: The Symfony\Bundle\TwigBundle\TwigEngine class is deprecated since version 4.3 and will be removed in 5.0; use \Twig\Environment instead.
2 times: The "framework.templating" configuration is deprecated since Symfony 4.3. Configure the "twig" section provided by the Twig Bundle instead.
Enabling the Templating component is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
The "templating.cache_warmer.template_paths" service is deprecated since Symfony 4.3 and will be removed in 5.0.
The Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplatePathsCacheWarmer class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
The "templating.finder" service is deprecated since Symfony 4.3 and will be removed in 5.0.
The Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinder class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
The Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface interface is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
The "templating.locator" service is deprecated since Symfony 4.3 and will be removed in 5.0.
The Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
The Symfony\Bundle\FrameworkBundle\Templating\TemplateReference class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
The "templating.name_parser" service is deprecated since Symfony 4.3 and will be removed in 5.0.
The Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser 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-templating-component-integration
解决方案:
composer.json
中删除 "symfony/templated"
framework.yaml
中删除此内容: templating:
engines:
- twig
composer更新
这应该删除所有弃用警告。
如果您收到此错误
Cannot autowire service "...": argument "$templating" of method "__construct()" references interface "Symfony\Bundle\FrameworkBundle\Templating\EngineInterface" but no such service exists. Did you create a class that implements this interface?
...您仍在某些服务中使用旧模板。
解决方案:将依赖项从 Symfony\Bundle\FrameworkBundle\Templated\EngineInterface
更改为 Twig\Environment
:
use Twig\Environment;
private $twig;
public function __construct(Environment $twig)
{
$this->twig = $twig;
}
关于php - Symfony 4.3 : User Deprecated: The Symfony\Bundle\TwigBundle\Loader\FilesystemLoader class is deprecated since version 4. 3 并将在 5.0 中删除...,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58380812/
我是一名优秀的程序员,十分优秀!