IcingaObject: add getUrlParams helper

This commit is contained in:
Thomas Gelf 2016-03-06 14:20:05 +01:00
parent 09e7a93b22
commit fb43331379
1 changed files with 21 additions and 0 deletions

View File

@ -1374,6 +1374,27 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
}
}
public function getUrlParams()
{
$params = array();
if ($this->object_type === 'apply') {
$params['id'] = $this->id;
} else {
$params = array('name' => $this->object_name);
if ($this->hasProperty('host_id')) {
$params['host'] = $this->host;
}
if ($this->hasProperty('service_id')) {
$params['service'] = $this->service;
}
}
return $params;
}
public function toJson(
$resolved = false,
$skipDefaults = false,