【问题标题】:configureListFields issue when I try to update a data with editable option当我尝试使用可编辑选项更新数据时出现 configureListFields 问题
【发布时间】:2019-10-30 21:46:01
【问题描述】:

我实际上是在尝试添加更新 SonataList 中的字段的可能性。

我遵循了 symfony 的文档 => https://symfony.com/doc/3.x/bundles/SonataAdminBundle/reference/action_list.html

我做了这段代码

->add('status', 'choice', [
            'label'    => 'Status',
            'class'    => 'secret',
            'editable' => true,
            'choices'  => [
                $inquiry_service::_statusInWaiting => 'En attente',
                $inquiry_service::_statusValidated => 'Validé',
                $inquiry_service::_statusRejected  => 'Rejeté',

结果是我可以在列表中选择我的 3 个选项,但是当我尝试更新数据时出现以下错误 =>

Catchable Fatal Error: Method WF\Sonata\AdminBundle\Admin\FieldDescription::__toString() must return a string value

我错过了哪些选项?

【问题讨论】:

    标签: php sonata symfony-2.8


    【解决方案1】:

    几个小时后,我发现 FieldDescription 对象返回 'true' 到 '$this->getLabel',这是由于版本过时导致的奏鸣曲问题。

    为了在不更新版本的情况下解决这个问题,我创建了一个带有选择表单的模板。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-08-19
      • 1970-01-01
      • 1970-01-01
      • 2020-03-04
      • 2010-11-30
      • 2022-01-08
      • 1970-01-01
      相关资源
      最近更新 更多