IcingaObjectImports: use new repository for lookup

This commit is contained in:
Thomas Gelf 2017-08-13 23:18:54 +02:00
parent 6c02d9c09a
commit a495a6ca39
1 changed files with 5 additions and 3 deletions

View File

@ -9,6 +9,7 @@ use Iterator;
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c; use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
use Icinga\Module\Director\IcingaConfig\IcingaConfigRenderer; use Icinga\Module\Director\IcingaConfig\IcingaConfigRenderer;
use Icinga\Module\Director\IcingaConfig\IcingaLegacyConfigHelper as c1; use Icinga\Module\Director\IcingaConfig\IcingaLegacyConfigHelper as c1;
use Icinga\Module\Director\Repository\IcingaTemplateRepository;
class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
{ {
@ -169,7 +170,7 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
protected function refreshIndex() protected function refreshIndex()
{ {
$this->idx = array_keys($this->imports); $this->idx = array_keys($this->imports);
$this->object->templateResolver()->refreshObject($this->object); // $this->object->templateResolver()->refreshObject($this->object);
return $this; return $this;
} }
@ -271,8 +272,9 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
protected function loadFromDb() protected function loadFromDb()
{ {
$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);
if (empty($this->objects)) { if (empty($this->objects)) {
$this->imports = array(); $this->imports = array();
} else { } else {