Skip to content

Commit

Permalink
fix: if an attribute is not required, allow it to not be set
Browse files Browse the repository at this point in the history
When using the API would get "Undefinedarray key" errors on missing
custom attributes, even though those attributes were not required.

Now allow the custom attribute to be missing if not a required custom
attribute.
  • Loading branch information
JohnVillalovos committed May 31, 2024
1 parent a27ce5b commit a08db74
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Application/Attributes/AttributeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ public function Validate($category, $attributeValues, $entityIds = [], $ignoreEm
continue;
}

if (!$attribute->Required() && !array_key_exists($attribute->Id(), $values)) {
continue;
}

$value = trim($values[$attribute->Id()]);
$label = $attribute->Label();

Expand Down

0 comments on commit a08db74

Please sign in to comment.