Skip to content

Commit

Permalink
Verhindert Fehlermeldung bei nicht existenztem Key
Browse files Browse the repository at this point in the history
Wenn mit `$dataset->getValue($key)` auf einen Key zugegriffen wird, der nicht existiert, wird ein Fehler ausgeworfen (Undefined array-key). Die unschöne Meldung lässt durch ein intern vorgeschaltetes `if hasValue` verhindern. Da `hasValue` bereits eine Abfrage auf `dataLoaded` durchführt, enthällt die Abfrage in der getValue-Methhode.

siehe FriendsOfREDAXO/neues#94 (comment)
  • Loading branch information
christophboecker authored Aug 24, 2024
1 parent 584d025 commit bf0b8fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/manager/lib/yform/manager/dataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,11 @@ public function getValue(string $key)
return $this->id;
}

if (!$this->dataLoaded) {
$this->loadData();
if ($this->hasValue($key) {
return $this->data[$key];
}

return $this->data[$key];
return null;
}

public function getData(): array
Expand Down

0 comments on commit bf0b8fc

Please sign in to comment.