diff options
author | rojaro <> | 2010-04-09 13:38:35 +0000 |
---|---|---|
committer | rojaro <> | 2010-04-09 13:38:35 +0000 |
commit | bbe6b5b15b523ff7ca50feaffce30004e746146d (patch) | |
tree | 0fa09e112fcc20e8c88acc988a1ea5f1c1cf976a /framework/TComponent.php | |
parent | f019963c124592d2f3c8ce9f4cf56f9109a8ad49 (diff) |
added ensureNullIfEmpty converter
Diffstat (limited to 'framework/TComponent.php')
-rw-r--r-- | framework/TComponent.php | 10 |
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; + } } /** |