mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 16:54:06 +02:00
IcingaObject: allow mor control over JSON structure
This commit is contained in:
parent
5bafc78f1c
commit
c62b008df8
@ -1090,14 +1090,23 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($skipNull) {
|
||||||
|
if (empty($props['imports'])) unset($props['imports']);
|
||||||
|
if (count((array) $props['vars']) === 0) unset($props['vars']);
|
||||||
|
if (empty($props['groups'])) unset($props['groups']);
|
||||||
|
}
|
||||||
|
|
||||||
ksort($props);
|
ksort($props);
|
||||||
|
|
||||||
return (object) $props;
|
return (object) $props;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toJson($resolved = false)
|
public function toJson(
|
||||||
{
|
$resolved = false,
|
||||||
return json_encode($this->toPlainObject($resolved));
|
$skipNull = false,
|
||||||
|
array $chosenProperties = null
|
||||||
|
) {
|
||||||
|
return json_encode($this->toPlainObject($resolved, $skipNull, $chosenProperties));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString()
|
public function __toString()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user