奏鸣曲管理员变量“form_helper”不存在。树枝更新后

Posted

技术标签:

【中文标题】奏鸣曲管理员变量“form_helper”不存在。树枝更新后【英文标题】:sonata admin Variable "form_helper" does not exist. after twig update 【发布时间】:2019-10-17 04:47:34 【问题描述】:

更新前(无错误)

symfony/twig-bridge v4.2.8  v4.3.0  Symfony Twig Bridge            
symfony/twig-bundle v4.2.8  v4.3.0  Symfony TwigBundle
twig/extensions     v1.5.4  v1.5.4  Common additional features for Twig that do not directly belong in core
twig/twig           v2.10.0 v2.11.0 Twig, the flexible, fast, and secure template language for php

更新后(错误奏鸣曲管理变量“form_helper”不存在。)

symfony/twig-bridge v4.3.0  v4.3.0  Symfony Twig Bridge            
symfony/twig-bundle v4.3.0  v4.3.0  Symfony TwigBundle
twig/extensions     v1.5.4  v1.5.4  Common additional features for Twig that do not directly belong in core
twig/twig           v2.11.0 v2.11.0 Twig, the flexible, fast, and secure template language for PHP

错误:

Variable "form_helper" does not exist.

in vendor/sonata-project/admin-bundle/src/Resources/views/CRUD/base_edit_form.html.twig (line 63)

奏鸣曲:

composer show --latest 'sonata-project/*'
sonata-project/admin-bundle              3.48.3 3.48.3 The missing Symfony Admin Generator
sonata-project/block-bundle              3.15.0 3.15.0 Symfony SonataBlockBundle
sonata-project/cache                     1.1.1  2.0.1  Cache library
sonata-project/cache-bundle              2.4.2  3.0.1  This bundle provides caching services
sonata-project/core-bundle               3.17.0 3.17.0 Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.5.0  3.0.0  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.3.0  1.3.0  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.9.0  3.9.0  Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0  2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter                  2.0.1  2.0.1  Lightweight Exporter library
sonata-project/notification-bundle       3.6.1  3.6.1  Symfony SonataNotificationBundle
sonata-project/page-bundle               3.11.1 3.11.1 This bundle provides a Site and Page management through container and block services
sonata-project/seo-bundle                2.7.0  2.7.0  Symfony SonataSeoBundle
sonata-project/translation-bundle        2.4.1  2.4.1  SonataTranslationBundle
sonata-project/user-bundle               4.3.0  4.3.0  Symfony SonataUserBundle

【问题讨论】:

【参考方案1】:

我不知道如何纠正它,但我只是恢复了

symfony/twig-bridge to v4.2.8
twig/twig to v2.10.0

我现在一切都好。希望对你有帮助。

我设置在composer.json

"symfony/twig-bridge": "4.2.8",
"twig/twig": "2.10"

和更新的作曲家。

【讨论】:

是的,这对我也有帮助,但对于新版本的奏鸣曲,我们应该修复它。【参考方案2】:

此错误是由@SonataAdmin/CRUD/base_edit_form.html.twig 的问题引起的。它固定在v3.49.0。见the related PR。

【讨论】:

以上是关于奏鸣曲管理员变量“form_helper”不存在。树枝更新后的主要内容,如果未能解决你的问题,请参考以下文章

奏鸣曲管理员 many_to_one 可编辑不起作用

symfony2:奏鸣曲 userbundle + fos userbundle + mongodb => 错误“sonata.user.mongodb.user_manager”不存在

用户组的奏鸣曲验证不起作用

奏鸣曲管理员列表可编辑与编辑/显示冲突

ruby form_helper.rb

将页面变量获取到奏鸣曲树枝模板