summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/TComponent.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/framework/TComponent.php b/framework/TComponent.php
index 647653dd..55c19ecf 100644
--- a/framework/TComponent.php
+++ b/framework/TComponent.php
@@ -801,6 +801,16 @@ class TPropertyValue
else
throw new TInvalidDataValueException('propertyvalue_enumvalue_invalid',$value,implode(' | ',$enums));
}
+
+ /**
+ * Converts the value to 'null' if the given value is empty
+ * @param mixed value to be converted
+ * @return mixed input or NULL if input is empty
+ */
+ public static function ensureNullIfEmpty($value)
+ {
+ return empty($value) ? null : $value;
+ }
}
/**