diff options
Diffstat (limited to 'lib/models')
| -rw-r--r-- | lib/models/DataField.php | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/models/DataField.php b/lib/models/DataField.php index a4b6f95..4f8ca36 100644 --- a/lib/models/DataField.php +++ b/lib/models/DataField.php @@ -264,6 +264,25 @@ class DataField extends SimpleORMap implements PrivacyObject } /** + * Returns whether this datafield is of a numeric type. + */ + public function isNumericType(): bool + { + if ($this->type === 'bool') { + return true; + } + + $entry = DataFieldEntry::createDataFieldEntry($this); + if (!$entry instanceof DataFieldSelectboxEntry) { + return false; + } + + [, $is_assoc] = $entry->getParameters(); + + return $is_assoc; + } + + /** * Export available data of a given user into a storage object * (an instance of the StoredUserData class) for that user. * @@ -287,6 +306,4 @@ class DataField extends SimpleORMap implements PrivacyObject } } } - - } |
