IcingaNotification: fix loading for apply objects

This commit is contained in:
Thomas Gelf 2016-03-10 21:05:27 +01:00
parent 1d243e0aaf
commit 47ef93cf91

View File

@ -37,10 +37,27 @@ class IcingaNotification extends IcingaObject
protected $relations = array(
'zone' => 'IcingaZone',
'host' => 'IcingaHost',
'service' => 'IcingaService',
'command' => 'IcingaCommand',
'period' => 'IcingaTimePeriod',
'service' => 'IcingaService',
);
// listOfRelations -> users, user_groups
protected function setKey($key)
{
if (is_int($key)) {
$this->id = $key;
} elseif (is_array($key)) {
foreach (array('id', 'host_id', 'service_id', 'object_name') as $k) {
if (array_key_exists($k, $key)) {
$this->set($k, $key[$k]);
}
}
} else {
return parent::setKey($key);
}
return $this;
}
}