diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php index e812623f..34a85f40 100644 --- a/library/Director/Objects/IcingaObject.php +++ b/library/Director/Objects/IcingaObject.php @@ -1033,9 +1033,13 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer public static function loadAllByType($type, Db $db, $query = null, $keyColumn = 'object_name') { - if ($type === 'datalistEntry') $keyColumn = 'entry_name'; $class = self::classByType($type); - return $class::loadAll($db, $query, $keyColumn); + + if (is_array($class::create()->getKeyName())) { + return $class::loadAll($db, $query); + } else { + return $class::loadAll($db, $query, $keyColumn); + } } public static function fromJson($json, Db $connection = null)