Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartosz Urbaniak committed Aug 31, 2023
1 parent 925cc0b commit 88a6d86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Service/Nelmio/DtoOADescriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ private function resolveProperties(
]);

if (is_array($model)) {
// checking whether there is an empty index by which you can distinguish whether the model is a collection of objects or a flat object
if (is_array($model[''] ?? null)) {
$property->type = "array";
$property->items = new Items([]);
Expand Down Expand Up @@ -345,7 +346,7 @@ private function getClassBags(
}

if ($item instanceof DtoTypeModel) {
if ($item->isCollection()) {
if ($item->isCollection()) { // forces an empty index to make it easier to check whether an element is an array
$propertyPath .= '.';
}
$bags = DtoUtil::mergeRecursively($bags, $this->getClassBags($item, $propertyPath));
Expand Down
1 change: 1 addition & 0 deletions src/Service/Validation/TypeValidationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function validateType(
}

$list = new ConstraintViolationList();

// coerce and copy sub-values
foreach ($subValues as $key => $value) {
if (null === ($result = $this->coercionService->coerce($key, $subProperties[$key], $value))) {
Expand Down

0 comments on commit 88a6d86

Please sign in to comment.