diff --git a/application/forms/IcingaServiceForm.php b/application/forms/IcingaServiceForm.php index ffb824c2..56e1b904 100644 --- a/application/forms/IcingaServiceForm.php +++ b/application/forms/IcingaServiceForm.php @@ -51,6 +51,10 @@ class IcingaServiceForm extends DirectorObjectForm */ public function setup() { + if (!$this->isNew() || $this->providesOverrides()) { + $this->tryToFetchHost(); + } + if ($this->providesOverrides()) { return; } @@ -60,14 +64,6 @@ class IcingaServiceForm extends DirectorObjectForm return; } - try { - if (!$this->isNew() && $this->host === null) { - $this->host = $this->object->getResolvedRelated('host'); - } - } catch (NestingError $nestingError) { - // ignore for the form to load - } - if ($this->set !== null) { $this->setupSetRelatedElements(); } elseif ($this->host === null) { @@ -77,6 +73,17 @@ class IcingaServiceForm extends DirectorObjectForm } } + protected function tryToFetchHost() + { + try { + if ($this->host === null) { + $this->host = $this->object->getResolvedRelated('host'); + } + } catch (NestingError $nestingError) { + // ignore for the form to load + } + } + protected function providesOverrides() { return $this->applyGenerated