From ad415e4fa69ec2cc2a7c5d293b28daeb6a86237b Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sun, 6 Mar 2016 14:26:48 +0100 Subject: [PATCH] ServiceController: object loading, id support --- application/controllers/ServiceController.php | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 60654910..39262cd1 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -43,16 +43,20 @@ class ServiceController extends ObjectController protected function loadObject() { - if ($this->object === null && $name = $this->params->get('name')) { - $params = array('object_name' => $name); - $db = $this->db(); + if ($this->object === null) { + if ($name = $this->params->get('name')) { + $params = array('object_name' => $name); + $db = $this->db(); - if ($hostname = $this->params->get('host')) { - $this->view->host = IcingaHost::load($hostname, $db); - $params['host_id'] = $this->view->host->id; + if ($hostname = $this->params->get('host')) { + $this->view->host = IcingaHost::load($hostname, $db); + $params['host_id'] = $this->view->host->id; + } + + $this->object = IcingaService::load($params, $db); + } else { + parent::loadObject(); } - - $this->object = IcingaService::load($params, $db); } return $this->object;