IcingaObject: allow to load by type with prefix

This commit is contained in:
Thomas Gelf 2015-08-29 01:12:04 +02:00
parent dd06be4a58
commit 4d34b2188e

View File

@ -718,11 +718,15 @@ return '';
protected static function classByType($type) protected static function classByType($type)
{ {
// allow for icinga_host and host
$type = preg_replace('/^icinga_/', '', $type);
if (strpos($type, 'data') === false) { if (strpos($type, 'data') === false) {
$prefix = 'Icinga'; $prefix = 'Icinga';
} else { } else {
$prefix = 'Director'; $prefix = 'Director';
} }
return 'Icinga\\Module\\Director\\Objects\\' . $prefix . ucfirst($type); return 'Icinga\\Module\\Director\\Objects\\' . $prefix . ucfirst($type);
} }