Skip to content

Commit

Permalink
fix: if an attribute is not required, allow it 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 17cbba4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Application/Attributes/AttributeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ 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 17cbba4

Please sign in to comment.