symfony更新2.6至3.4后的奏鸣曲/小枝错误 [英] sonata/twig error after symfony update 2.6 to 3.4

查看:144
本文介绍了symfony更新2.6至3.4后的奏鸣曲/小枝错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将一个项目从sf2.6(php5.6)更新到sf3.4(php7.1)...进展顺利,但现在我陷入了一个错误,我无法弄清楚如何解决它

im updating a project from sf2.6(php5.6) to sf3.4(php7.1)... its going well but now im stuck with an error i cant figure out how to fix it

错误输出: PHP message: PHP Fatal error: Uncaught Symfony\\Component\\Debug\\Exception\\FatalThrowableError: Type error: Argument 2 passed to Sonata\\FormatterBundle\\Formatter\\Pool::add() must implement interface Sonata\\FormatterBundle\\Formatter\\FormatterInterface, boolean given, called in /var/www/var/cache/dev/ContainerMklcxqq/appDevDebugProjectContainer.php on line 4924 in /var/www/vendor/sonata-project/formatter-bundle/src/Formatter/Pool.php:43\nStack trace:\n#0 /var/www/var/cache/dev/ContainerMklcxqq/appDevDebugProjectContainer.php(4924): Sonata\\FormatterBundle\\Formatter\\Pool->add('twig', true, NULL)\n#1 /var/www/var/cache/dev/ContainerMklcxqq/appDevDebugProjectContainer.php(3475): ContainerMklcxqq\\appDevDebugProjectContainer->getSonata_Formatter_PoolService()\n#2 /var/www/var/cache/dev/ContainerMklcxqq/getAssetic_AssetManagerService.php(8): ContainerMklcxqq\\appDevDebugProjectContainer->getTwigService()\n#3 /var/www/var/cache/dev/ContainerMklcxqq/appDevDebugProjectContainer.php(1349): require('/var/www/var/ca...')\n#4 /v...\n'

如果我在我发现的容器中检查了提到的行(4924),

if i check the mentioned line (4924) in the container i find:

$instance->add('twig', ${($_ = isset($this- >services['sonata.formatter.text.twigengine']) ? $this- 
>services['sonata.formatter.text.twigengine'] : $this- 
>getSonata_Formatter_Text_TwigengineService()) && false ?: '_'}, NULL);

当我使用"bin/console debug:container sonata.formatter.text.twigengine"检查实际服务时,我得到以下信息,这很好,我猜:

when i check the actual service with "bin/console debug:container sonata.formatter.text.twigengine" i get the following, which is good, i guess:

Information for Service "sonata.formatter.text.twigengine"
==========================================================

 ---------------- ------------------------------------------------
  Option           Value
 ---------------- ------------------------------------------------
  Service ID       sonata.formatter.text.twigengine
  Class            Sonata\FormatterBundle\Formatter\TwigFormatter
  Tags             sonata.text.formatter
  Public           no
  Synthetic        no
  Lazy             no
  Shared           yes
  Abstract         no
  Autowired        no
  Autoconfigured   no
 ---------------- ------------------------------------------------

最后我检查了实际的TwigFormatter类,这导致了这篇文章:

and finally i checked the actual TwigFormatter class, which leads to this post:

final class TwigFormatter implements FormatterInterface

怎么可能发生此错误,我应该解决此问题还是需要任何软件包更新?我使用了最新版本的sonata-project/formatter-bundle以及最新版本的twig/twig.

how is this error possible and am i supposed to fix this or is any package update needed? im using the newest version of the sonata-project/formatter-bundle and also the newest version of twig/twig.

帮助和解释深表感谢.谢谢大家.

help and explanation is much appreciated. thanks guys.

推荐答案

此错误来自Symfony,请参见

This bug comes from Symfony, see BUG: FormatterBundle\Formatter\Pool::add() must implement interface then [DI] Error on dumped container for inlined services

您必须等待此修补程序被合并,或者您是玩家,请自己应用.

You'll have to wait for this fix to be merged, or if you're a player, apply it yourself.

这篇关于symfony更新2.6至3.4后的奏鸣曲/小枝错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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