mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
Fix warning when optional attribute doesn't exist
When an attribute required is set to `false` and the attribute doesn't exist in the response, we get warning `undefined array key "attribute"` in the console, this update prevents that error
This commit is contained in:
parent
ae87033974
commit
c0efc232ad
1 changed files with 4 additions and 0 deletions
|
|
@ -590,6 +590,10 @@ class Response extends SwooleResponse
|
|||
}
|
||||
}
|
||||
|
||||
if(!$data->isSet($key) && !$rule['required']) { // skip attribute in response if not required and values does not exist
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($rule['array']) {
|
||||
if (!is_array($data[$key])) {
|
||||
throw new Exception($key . ' must be an array of type ' . $rule['type']);
|
||||
|
|
|
|||
Loading…
Reference in a new issue