IcingaObjectFieldLoader: do not fail on emtpy...

...parents
This commit is contained in:
Thomas Gelf 2016-10-14 08:33:58 +00:00
parent 9e977eaf9a
commit e04acbc55f

View File

@ -146,16 +146,17 @@ class IcingaObjectFieldLoader
protected function loadDataFieldsForObjects($objectList) protected function loadDataFieldsForObjects($objectList)
{ {
if (empty($objectList)) {
// Or should we fail?
return array();
}
$ids = array(); $ids = array();
$objects = array(); $objects = array();
foreach ($objectList as $object) { foreach ($objectList as $object) {
$ids[] = $object->id; if ($object->hasBeenLoadedFromDb()) {
$objects[$object->id] = $object; $ids[] = $object->id;
$objects[$object->id] = $object;
}
}
if (empty($ids)) {
return array();
} }
$connection = $object->getConnection(); $connection = $object->getConnection();