mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-25 23:04:53 +02:00
IcingaObject: smaller methods for import resolvers
This commit is contained in:
parent
df2a5899f6
commit
018713a13f
@ -564,21 +564,26 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
if ($this->importedObjects === null) {
|
if ($this->importedObjects === null) {
|
||||||
$this->importedObjects = array();
|
$this->importedObjects = array();
|
||||||
foreach ($this->imports()->listImportNames() as $import) {
|
foreach ($this->imports()->listImportNames() as $import) {
|
||||||
if (is_array($this->getKeyName())) {
|
$this->importedObjects[$import] = $this->loadImportedObject($import);
|
||||||
// Affects services only:
|
|
||||||
$this->importedObjects[$import] = self::load(
|
|
||||||
array('object_name' => $import),
|
|
||||||
$this->connection
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$this->importedObjects[$import] = self::load($import, $this->connection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->importedObjects;
|
return $this->importedObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function loadImportedObject($name)
|
||||||
|
{
|
||||||
|
if (is_array($this->getKeyName())) {
|
||||||
|
// Affects services only:
|
||||||
|
return self::load(
|
||||||
|
array('object_name' => $import),
|
||||||
|
$this->connection
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return self::load($name, $this->connection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function clearImportedObjects()
|
public function clearImportedObjects()
|
||||||
{
|
{
|
||||||
$this->importedObjects = null;
|
$this->importedObjects = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user