Skip to content

Commit

Permalink
fix(x-editable): choice value update crash with 0 value
Browse files Browse the repository at this point in the history
Because of the weak comparison, if we try to update a choice list field
with a value of 0, it is considered as a violation.
  • Loading branch information
soullivaneuh committed Jul 19, 2021
1 parent a17197b commit 878728a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Action/SetObjectFieldValueAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function __invoke(Request $request): JsonResponse
$value = $dataTransformer->reverseTransform($value);
}

if (!$value && FieldDescriptionInterface::TYPE_CHOICE === $fieldDescription->getType()) {
if (null === $value && FieldDescriptionInterface::TYPE_CHOICE === $fieldDescription->getType()) {
return new JsonResponse(sprintf(
'Edit failed, object with id: %s not found in association: %s.',
$originalValue,
Expand Down

0 comments on commit 878728a

Please sign in to comment.