IcingaService: force object_type=template when...

...loading a service by name

fixes #1094
This commit is contained in:
Thomas Gelf 2017-08-25 16:10:59 +02:00
parent 2b386fa856
commit bab28b1755
1 changed files with 15 additions and 0 deletions

View File

@ -415,6 +415,21 @@ class IcingaService extends IcingaObject
return $zone;
}
public function createWhere()
{
$where = parent::createWhere();
if (! $this->hasBeenLoadedFromDb()) {
if (null === $this->get('service_set_id')
&& null === $this->get('host_id')
&& null === $this->get('id')
) {
$where .= " AND object_type = 'template'";
}
}
return $where;
}
// TODO: Duplicate code, clean this up, split it into multiple methods
public static function enumProperties(
Db $connection = null,