From 4d34b2188e86c54ebc7a19c07a4571501c4d4fa7 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sat, 29 Aug 2015 01:12:04 +0200 Subject: [PATCH] IcingaObject: allow to load by type with prefix --- library/Director/Objects/IcingaObject.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php index cd967f69..37ed681b 100644 --- a/library/Director/Objects/IcingaObject.php +++ b/library/Director/Objects/IcingaObject.php @@ -718,11 +718,15 @@ return ''; protected static function classByType($type) { + // allow for icinga_host and host + $type = preg_replace('/^icinga_/', '', $type); + if (strpos($type, 'data') === false) { $prefix = 'Icinga'; } else { $prefix = 'Director'; } + return 'Icinga\\Module\\Director\\Objects\\' . $prefix . ucfirst($type); }