IcingaObject: provide plain object

This commit is contained in:
Thomas Gelf 2015-12-03 14:20:29 +01:00
parent 8d173b9602
commit 039542c473
1 changed files with 7 additions and 2 deletions

View File

@ -865,7 +865,7 @@ return '';
return $class::loadAll($db, $query, $keyColumn); return $class::loadAll($db, $query, $keyColumn);
} }
public function toJson($resolved = false) public function toPlainObject($resolved = false)
{ {
$props = array(); $props = array();
foreach ($this->getProperties() as $k => $v) { foreach ($this->getProperties() as $k => $v) {
@ -889,7 +889,12 @@ return '';
$props['imports'] = $this->imports()->listImportNames(); $props['imports'] = $this->imports()->listImportNames();
} }
return json_encode($props); return (object) $props;
}
public function toJson($resolved = false)
{
return json_encode($this->toPlainObject($resolved));
} }
public function __toString() public function __toString()