Closed Minirock closed 4 years ago
You have to set the transform option to true
, this transforms your boolean value to the YES/NO options in the BooleanType:
$formMapper
->add('enabled', BooleanType::class, [
'transform' => true
])
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
@jeroendk solution worked
But BooleanType
is not a good code. What's in author's mind to create constants like that for a boolean type?
public const TYPE_YES = 1;
public const TYPE_NO = 2;
Environment
Sonata packages
Symfony packages
Subject
I have an entity with a boolean field. If I create a record with the boolean set to false, then in the view list I can see "no" as expected, but in the form list I can see "yes"
This is happening when the boolean field is set with BooleanType in the Admin configureFormFields. But, if I use the CheckBoxType then all works fine.
So looks like this is only related to BooleanType.