Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bf23a70

Browse files
authored
bug #12823 [API] Allow creation of commands with no arguments with a default value (GSadee)
This PR was merged into the 1.9 branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | 1.9 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | fixes #12811 | License | MIT Fixes tests on 1.10 and master branches, where we test [RegisterShopUser](https://github.com/Sylius/Sylius/blob/1.10/src/Sylius/Bundle/ApiBundle/Command/RegisterShopUser.php#L69) that has new not nullable argument with a default value. Failing test: https://github.com/Sylius/Sylius/runs/3122767036?check_suite_focus=true#step:18:75 Commits ------- 80836cf [API] Allow creation of commands with no arguments with a default value
2 parents d0eedd7 + 80836cf commit bf23a70

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Sylius/Bundle/ApiBundle/Serializer/CommandDenormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function denormalize($data, $type, $format = null, array $context = [])
4141

4242
$missingFields = [];
4343
foreach ($parameters as $parameter) {
44-
if (!isset($data[$parameter->getName()]) && !$parameter->allowsNull()) {
44+
if (!isset($data[$parameter->getName()]) && !($parameter->allowsNull() || $parameter->isDefaultValueAvailable())) {
4545
$missingFields[] = $parameter->getName();
4646
}
4747
}

0 commit comments

Comments
 (0)