mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-09-25 18:59:05 +02:00
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:
parent
d8b1207254
commit
d5807495a0
@ -145,13 +145,18 @@ class TemplateTree
|
|||||||
protected function getAncestorsForUnstoredObject(IcingaObject $object)
|
protected function getAncestorsForUnstoredObject(IcingaObject $object)
|
||||||
{
|
{
|
||||||
$this->requireTree();
|
$this->requireTree();
|
||||||
$names = $object->imports()->listImportNames();
|
|
||||||
$ancestors = [];
|
$ancestors = [];
|
||||||
foreach ($names as $name) {
|
foreach ($object->imports() as $import) {
|
||||||
if (! array_key_exists($name, $this->templateNameToId)) {
|
$name = $import->getObjectName();
|
||||||
continue;
|
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);
|
$this->getAncestorsById($pid, $ancestors);
|
||||||
|
|
||||||
// Hint: inheritance order matters
|
// Hint: inheritance order matters
|
||||||
|
Loading…
x
Reference in New Issue
Block a user