IcingaTemplateResolver: more tweaking

refs #12922
This commit is contained in:
Thomas Gelf 2016-10-14 09:40:01 +00:00
parent 61f3ffff7e
commit 98acba9fb4
2 changed files with 16 additions and 3 deletions

View File

@ -749,6 +749,11 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
return $this->imports;
}
public function gotImports()
{
return $this->imports !== null;
}
public function setImports($imports)
{
if (! is_array($imports) && $imports !== null) {

View File

@ -79,8 +79,16 @@ class IcingaTemplateResolver
$this->requireTemplates();
if ($id === null) {
$id = $this->object->id;
if (! $id && $this->object->imports()->hasBeenModified()) {
$object = $this->object;
if ($object->hasBeenLoadedFromDb()) {
if ($object->gotImports() && $object->imports()->hasBeenModified()) {
return $this->listUnstoredParentIds();
}
$id = $object->id;
} else {
return $this->listUnstoredParentIds();
}
}
@ -210,7 +218,7 @@ class IcingaTemplateResolver
protected function getIdsForNames($names)
{
$id = array();
$ids = array();
foreach ($names as $name) {
$ids[] = $this->getIdForName($name);
}