mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-09-26 03:09:11 +02:00
parent
8402f58610
commit
a092c5d79e
@ -19,7 +19,6 @@ use Icinga\Module\Director\IcingaConfig\IcingaConfigRenderer;
|
|||||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||||
use Icinga\Module\Director\IcingaConfig\IcingaLegacyConfigHelper as c1;
|
use Icinga\Module\Director\IcingaConfig\IcingaLegacyConfigHelper as c1;
|
||||||
use Icinga\Module\Director\Repository\IcingaTemplateRepository;
|
use Icinga\Module\Director\Repository\IcingaTemplateRepository;
|
||||||
use Icinga\Module\Director\Resolver\TemplateTree;
|
|
||||||
|
|
||||||
abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
||||||
{
|
{
|
||||||
@ -871,6 +870,10 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
return $this->listImportNames();
|
return $this->listImportNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This should no longer be in use
|
||||||
|
* @return IcingaTemplateResolver
|
||||||
|
*/
|
||||||
public function templateResolver()
|
public function templateResolver()
|
||||||
{
|
{
|
||||||
if ($this->templateResolver === null) {
|
if ($this->templateResolver === null) {
|
||||||
@ -2437,7 +2440,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
|
|
||||||
if ($object->supportsCustomVars()) {
|
if ($object->supportsCustomVars()) {
|
||||||
$vars = $object->getVars();
|
$vars = $object->getVars();
|
||||||
$object->vars = array();
|
$object->set('vars', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setProperties((array) $object->toPlainObject(null, true));
|
$this->setProperties((array) $object->toPlainObject(null, true));
|
||||||
|
@ -274,7 +274,8 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
|
|||||||
{
|
{
|
||||||
// $resolver = $this->object->templateResolver();
|
// $resolver = $this->object->templateResolver();
|
||||||
// $this->objects = $resolver->fetchParents();
|
// $this->objects = $resolver->fetchParents();
|
||||||
$this->objects = IcingaTemplateRepository::instanceByObject($this->object)->getTemplatesFor($this->object);
|
$this->objects = IcingaTemplateRepository::instanceByObject($this->object)
|
||||||
|
->getTemplatesIndexedByNameFor($this->object);
|
||||||
if (empty($this->objects)) {
|
if (empty($this->objects)) {
|
||||||
$this->imports = array();
|
$this->imports = array();
|
||||||
} else {
|
} else {
|
||||||
|
@ -50,6 +50,20 @@ class IcingaTemplateRepository
|
|||||||
return $templates;
|
return $templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param IcingaObject $object
|
||||||
|
* @return IcingaObject[]
|
||||||
|
*/
|
||||||
|
public function getTemplatesIndexedByNameFor(IcingaObject $object)
|
||||||
|
{
|
||||||
|
$templates = [];
|
||||||
|
foreach ($this->getTemplatesFor($object) as $template) {
|
||||||
|
$templates[$template->getObjectName()] = $template;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $templates;
|
||||||
|
}
|
||||||
|
|
||||||
public function persistImportNames()
|
public function persistImportNames()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user