ServiceController: load Set and Host before...

...the service, which get's loaded in the parent class

fixes #2452
fixes #2449
This commit is contained in:
Thomas Gelf 2021-12-23 10:25:59 +01:00
parent 212596a41e
commit 1cbb033911
2 changed files with 4 additions and 3 deletions

View File

@ -39,9 +39,10 @@ class ServiceController extends ObjectController
public function init()
{
parent::init();
// Hint: having Host and Set loaded first is important for UUID lookups with legacy URLs
$this->loadOptionalHost();
$this->loadOptionalSet();
parent::init();
$this->addOptionalHostTabs();
$this->addOptionalSetTabs();
}

View File

@ -33,10 +33,10 @@ class UuidLookup
$query = $db->select()->from('icinga_service', 'uuid')->where('object_type = ?', $objectType);
$query = self::addKeyToQuery($connection, $query, $key);
if ($host) {
$query->add('host_id = ?', $host->get('id'));
$query->where('host_id = ?', $host->get('id'));
}
if ($set) {
$query->add('service_set_id = ?', $set->get('id'));
$query->where('service_set_id = ?', $set->get('id'));
}
$uuid = self::fetchOptionalUuid($connection, $query);