Search code examples
phpsonatasymfony-2.8

configureListFields issue when I try to update a data with editable option


I am actually trying to add the possibility to update a field in a SonataList.

I followed the documentation of symfony => https://symfony.com/doc/3.x/bundles/SonataAdminBundle/reference/action_list.html

And I did this code

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

The result is that I can select on my list my 3 choices but when I try to update the data I have this following error =>

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

Which options I missed ?


Solution

  • After few hours, I found that the FieldDescription object returned 'true' to '$this->getLabel' and It was a sonata issue due to an outdated version.

    To solve it without updated my version, I created a template with a choice form.