This fixes choices when all the keys are strings (but integers really). That's because in PHP, if you have the following array: array('1' => 'foo', '2' => 'bar'); PHP "converts" it automatically to the following array: array(1 => 'foo', 2 => 'bar');
@@ -87,7 +87,7 @@ class ScalarToBooleanChoicesTransformer implements DataTransformerInterface
foreach ($value as $choice => $selected) {
if ($selected) {
- return $choice;
+ return (string) $choice;
}