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
1 changed files with 4 additions and 0 deletions

View File

@ -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);
}