[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaObject: introduce differsFromDefaultValue

git at icinga.org git at icinga.org
Tue Feb 23 03:15:20 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: 23090c502acbbc90bece115be7b829df368a6af9
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=23090c502acbbc90bece115be7b829df368a6af9

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Feb 23 00:26:39 2016 +0100

IcingaObject: introduce differsFromDefaultValue

---

 library/Director/Objects/IcingaObject.php |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php
index 8e27e1e..680ec79 100644
--- a/library/Director/Objects/IcingaObject.php
+++ b/library/Director/Objects/IcingaObject.php
@@ -1129,6 +1129,15 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
         return (object) $props;
     }
 
+    protected function differsFromDefaultValue($key, $value)
+    {
+        if (array_key_exists($key, $this->defaultProperties)) {
+            return $value !== $this->defaultProperties[$key];
+        } else {
+            return $value !== null;
+        }
+    }
+
     public function toJson(
         $resolved = false,
         $skipNull = false,



More information about the icinga-checkins mailing list