IcingaObjectImports: attempt to fix history

This commit is contained in:
Thomas Gelf 2015-08-28 17:11:51 +02:00
parent 3d38a6fec9
commit 3811c1612b
1 changed files with 19 additions and 2 deletions

View File

@ -178,6 +178,11 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
return array_keys($this->imports);
}
public function listOriginalImportNames()
{
return array_keys($this->storedImports);
}
public function getType()
{
return $this->object->getShortTableName();
@ -207,8 +212,12 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
$class = $this->getImportClass();
$this->imports = $class::loadAll($connection, $query, 'object_name');
$this->storedImports = $this->imports;
$this->storedImports = array();
foreach ($this->imports as $k => $v) {
$this->storedImports[$k] = clone($v);
}
$this->cloneStored();
return $this;
}
@ -241,11 +250,19 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
);
}
$this->storedImports = $this->imports;
$this->cloneStored();
return true;
}
protected function cloneStored()
{
$this->storedImports = array();
foreach ($this->imports as $k => $v) {
$this->storedImports[$k] = clone($v);
}
}
protected function getImportClass()
{
return get_class($this->object);