how to handle boolean values in Doctrine Admin Bundle

824 views
Skip to first unread message

Torsten

unread,
Nov 21, 2011, 10:03:10 AM11/21/11
to sonata-users
Hi

I have Entity with a boolean value defined, when calling the create
action to the the form I get the Foolowing ExceptioN:

Expected argument of type "Boolean", "integer" given

from /vendor/symfony/src/Symfony/Component/Form/Extension/Core/
DataTransformer/BooleanToStringTransformer.php

Surely it is not an boolean Value since it comes from an Mysql
Database.

Is there a way to handle that properly


Thanks Torsten

Torsten

unread,
Nov 21, 2011, 10:10:04 AM11/21/11
to sonata-users
sorry I just found ou: with choice.
Iw would be nice thought, if a boolean value ich recognized
automtically.

frak

unread,
Nov 28, 2012, 4:36:03 PM11/28/12
to sonata...@googlegroups.com, torste...@googlemail.com
Just to clarify for anyone stumbling upon this error, the way I got this to work was by changing the type:

->add('published', 'sonata_type_boolean', array('required' => false))
Reply all
Reply to author
Forward
0 new messages