Browse Source

Fix the incorrect handling of boolean types (#4369)

Marco Polichetti 8 năm trước cách đây
mục cha
commit
3780cc269e
1 tập tin đã thay đổi với 5 bổ sung0 xóa
  1. 5 0
      Controller/HelperController.php

+ 5 - 0
Controller/HelperController.php

@@ -285,6 +285,11 @@ class HelperController
             $value = new \DateTime($value);
         }
 
+        // Handle boolean type transforming the value into a boolean
+        if ('' !== $value && $fieldDescription->getType() == 'boolean') {
+            $value = filter_var($value, FILTER_VALIDATE_BOOLEAN);
+        }
+
         $this->pool->getPropertyAccessor()->setValue($object, $propertyPath, '' !== $value ? $value : null);
 
         $violations = $this->validator->validate($object);