diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php index aed2c921..cc7d886d 100644 --- a/library/Director/Objects/IcingaObject.php +++ b/library/Director/Objects/IcingaObject.php @@ -978,8 +978,11 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer return $this; } - public function toPlainObject($resolved = false) - { + public function toPlainObject( + $resolved = false, + $skipNull = false, + array $chosenProperties = null + ) { $props = array(); if ($resolved) { @@ -1007,8 +1010,14 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer } } + if ($chosenProperties !== null) { + if (! in_array($v, $chosenProperties)) { + continue; + } + } + // TODO: Do not ship null properties based on flag? - if (true || $v !== null) { + if (!$skipNull || $v !== null) { $props[$k] = $v; } }