TemplateTree: load inheritance for unstored...

...objects even if the given parent is not a template. This happens with fake
objects while managing overrides
This commit is contained in:
Thomas Gelf 2018-05-22 14:40:56 +02:00
parent d8b1207254
commit d5807495a0
1 changed files with 10 additions and 5 deletions

View File

@ -145,13 +145,18 @@ class TemplateTree
protected function getAncestorsForUnstoredObject(IcingaObject $object)
{
$this->requireTree();
$names = $object->imports()->listImportNames();
$ancestors = [];
foreach ($names as $name) {
if (! array_key_exists($name, $this->templateNameToId)) {
continue;
foreach ($object->imports() as $import) {
$name = $import->getObjectName();
if ($import->hasBeenLoadedFromDb()) {
$pid = $import->get('id');
} else {
if (! array_key_exists($name, $this->templateNameToId)) {
continue;
}
$pid = $this->templateNameToId[$name];
}
$pid = $this->templateNameToId[$name];
$this->getAncestorsById($pid, $ancestors);
// Hint: inheritance order matters