mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-27 15:54:03 +02:00
IcingaObject: new static loadByType() method
This commit is contained in:
parent
bf596d98ee
commit
ab2e55321d
@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Objects;
|
||||
|
||||
use Icinga\Module\Director\CustomVariable\CustomVariables;
|
||||
use Icinga\Module\Director\Data\Db\DbObject;
|
||||
use Icinga\Module\Director\Db;
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigRenderer;
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
@ -616,6 +617,13 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
||||
}
|
||||
}
|
||||
|
||||
public static function loadByType($type, $id, Db $connection)
|
||||
{
|
||||
$class = 'Icinga\\Module\\Director\\Objects\\Icinga' . ucfirst($type);
|
||||
|
||||
return $class::load($id, $connection);
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user