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) {
|
||||
$this->importedObjects = array();
|
||||
foreach ($this->imports()->listImportNames() as $import) {
|
||||
if (is_array($this->getKeyName())) {
|
||||
// Affects services only:
|
||||
$this->importedObjects[$import] = self::load(
|
||||
array('object_name' => $import),
|
||||
$this->connection
|
||||
);
|
||||
} else {
|
||||
$this->importedObjects[$import] = self::load($import, $this->connection);
|
||||
}
|
||||
$this->importedObjects[$import] = $this->loadImportedObject($import);
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
$this->importedObjects = null;
|
||||
|
|
Loading…
Reference in New Issue