summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorrojaro <>2010-04-09 13:38:35 +0000
committerrojaro <>2010-04-09 13:38:35 +0000
commitbbe6b5b15b523ff7ca50feaffce30004e746146d (patch)
tree0fa09e112fcc20e8c88acc988a1ea5f1c1cf976a /framework
parentf019963c124592d2f3c8ce9f4cf56f9109a8ad49 (diff)
added ensureNullIfEmpty converter
Diffstat (limited to 'framework')
-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;
+ }
}
/**