Skip to content

Commit

Permalink
bug #12823 [API] Allow creation of commands with no arguments with a …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Zales0123 committed Jul 21, 2021
2 parents d0eedd7 + 80836cf commit bf23a70
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function denormalize($data, $type, $format = null, array $context = [])

$missingFields = [];
foreach ($parameters as $parameter) {
if (!isset($data[$parameter->getName()]) && !$parameter->allowsNull()) {
if (!isset($data[$parameter->getName()]) && !($parameter->allowsNull() || $parameter->isDefaultValueAvailable())) {
$missingFields[] = $parameter->getName();
}
}
Expand Down

0 comments on commit bf23a70

Please sign in to comment.