From 3811c1612b4620efe8019def86d87610e1eefff5 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 28 Aug 2015 17:11:51 +0200 Subject: [PATCH] IcingaObjectImports: attempt to fix history --- .../Director/Objects/IcingaObjectImports.php | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/library/Director/Objects/IcingaObjectImports.php b/library/Director/Objects/IcingaObjectImports.php index 470c1244..7d2585d7 100644 --- a/library/Director/Objects/IcingaObjectImports.php +++ b/library/Director/Objects/IcingaObjectImports.php @@ -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);