Deprecate symfony solve

huangapple go评论76阅读模式
英文:

Deprecate symfony solve

问题

如何解决在将Symfony升级到4.4版本后出现的问题:

[2020-01-03 08:46:27] php.INFO: 用户已弃用:自Symfony 4.4起,"twig.exception_listener"服务已弃用。 {"exception":"[object] (ErrorException(code: 0): 用户已弃用:自Symfony 4.4起,"twig.exception_listener"服务已弃用。位于/var/www/api/var/cache/prod/Container8sfHI7P/getTwig_ExceptionListenerService.php:9)"} []
[2020-01-03 08:46:27] php.INFO: 用户已弃用:自Symfony 4.4起,"Symfony\Component\HttpKernel\EventListener\ExceptionListener"类已弃用,请改用"ErrorListener"。 {"exception":"[object] (ErrorException(code: 0): 用户已弃用:自Symfony 4.4起,"Symfony\Component\HttpKernel\EventListener\ExceptionListener"类已弃用,请改用"ErrorListener"。位于/var/www/api/vendor/symfony/http-kernel/EventListener/ExceptionListener.php:25)"} []
[2020-01-02 05:28:12] php.INFO: 用户已弃用:自Symfony 4.2起,为"\App\Controller\InstallController"自动注入容器已弃用。请将其配置为服务。 {"exception":"[object] (ErrorException(code: 0): 用户已弃用:自Symfony 4.2起,为"\App\Controller\InstallController"自动注入容器已弃用。请将其配置为服务。位于/var/www/api/vendor/symfony/framework-bundle/Controller/ControllerResolver.php:64)"} []

请注意,我只翻译了代码部分,没有包括其他内容。

英文:

How to solve this problems after update symfony to ver 4.4

[2020-01-03 08:46:27] php.INFO: User Deprecated: The "twig.exception_listener" service is deprecated since Symfony 4.4. {"exception":"[object] (ErrorException(code: 0): User Deprecated: The \"twig.exception_listener\" service is deprecated since Symfony 4.4. at /var/www/api/var/cache/prod/Container8sfHI7P/getTwig_ExceptionListenerService.php:9)"} []
[2020-01-03 08:46:27] php.INFO: User Deprecated: The "Symfony\Component\HttpKernel\EventListener\ExceptionListener" class is deprecated since Symfony 4.4, use "ErrorListener" instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: The \"Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener\" class is deprecated since Symfony 4.4, use \"ErrorListener\" instead. at /var/www/api/vendor/symfony/http-kernel/EventListener/ExceptionListener.php:25)"} []
[2020-01-02 05:28:12] php.INFO: User Deprecated: Auto-injection of the container for "\App\Controller\InstallController" is deprecated since Symfony 4.2. Configure it as a service instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Auto-injection of the container for \"\\App\\Controller\\InstallController\" is deprecated since Symfony 4.2. Configure it as a service instead. at /var/www/api/vendor/symfony/framework-bundle/Controller/ControllerResolver.php:64)"} []

答案1

得分: 6

我发现这个问题也很棘手。它不会在composer更新时自动解决,因为它是仅在首次要求包时才从其recipe应用的配置的一部分。

您需要更改三个与默认配置中的更改相同的内容(我在下面使用点表示嵌套键):

  • config/packages/twig.yaml 中添加 twig.exception_controller: null
  • config/routes/dev/twig.yaml 中将 _errors.resource 更改为 @FrameworkBundle/Resources/config/routing/errors.xml
  • config/routes/dev/twig.yaml 重命名为 config/routes/dev/framework.yaml
英文:

I found this one tricky to solve as well. It's not automatically resolved by a composer update because it's part of the configuration that's only applied from it's recipe when you require a package for the first time.

You'll have to change three things that are also changed in the default configuration for 4.4 (I used dots below to indicate nested keys):

  • in config/packages/twig.yaml add twig.exception_controller: null
  • in config/routes/dev/twig.yaml change the _errors.resource to @FrameworkBundle/Resources/config/routing/errors.xml
  • rename config/routes/dev/twig.yaml to config/routes/dev/framework.yaml

huangapple
  • 本文由 发表于 2020年1月3日 23:55:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/59581560.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定