From 47ef93cf91f951eeda3003d78bf400b368bcdb28 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 10 Mar 2016 21:05:27 +0100 Subject: [PATCH] IcingaNotification: fix loading for apply objects --- .../Director/Objects/IcingaNotification.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/library/Director/Objects/IcingaNotification.php b/library/Director/Objects/IcingaNotification.php index c0259323..8f5bd801 100644 --- a/library/Director/Objects/IcingaNotification.php +++ b/library/Director/Objects/IcingaNotification.php @@ -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; + } }