[icinga-checkins] icinga.org: icingaweb2-module-director/feature/service-set-12891: IcingaObjectFieldLoader: do not fail on emtpy...

git at icinga.org git at icinga.org
Fri Oct 14 15:44:43 CEST 2016


Module: icingaweb2-module-director
Branch: feature/service-set-12891
Commit: e04acbc55fc26e4548d7bfd25799122ce89aa615
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=e04acbc55fc26e4548d7bfd25799122ce89aa615

Author: Thomas Gelf <thomas at gelf.net>
Date:   Fri Oct 14 08:33:58 2016 +0000

IcingaObjectFieldLoader: do not fail on emtpy...

...parents

---

 library/Director/Web/Form/IcingaObjectFieldLoader.php |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/library/Director/Web/Form/IcingaObjectFieldLoader.php b/library/Director/Web/Form/IcingaObjectFieldLoader.php
index cd3ce09..e8feec3 100644
--- a/library/Director/Web/Form/IcingaObjectFieldLoader.php
+++ b/library/Director/Web/Form/IcingaObjectFieldLoader.php
@@ -146,16 +146,17 @@ class IcingaObjectFieldLoader
 
     protected function loadDataFieldsForObjects($objectList)
     {
-        if (empty($objectList)) {
-            // Or should we fail?
-            return array();
-        }
-
         $ids = array();
         $objects = array();
         foreach ($objectList as $object) {
-            $ids[] = $object->id;
-            $objects[$object->id] = $object;
+            if ($object->hasBeenLoadedFromDb()) {
+                $ids[] = $object->id;
+                $objects[$object->id] = $object;
+            }
+        }
+
+        if (empty($ids)) {
+            return array();
         }
 
         $connection = $object->getConnection();



More information about the icinga-checkins mailing list