IcingaObject: failsafe helper for related object

This commit is contained in:
Thomas Gelf 2016-03-18 11:43:40 +01:00
parent 4119fee9bb
commit 1dbf2e8410
1 changed files with 11 additions and 0 deletions

View File

@ -202,6 +202,17 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
return $class::loadWithAutoIncId($id, $this->connection);
}
public function getResolvedRelated($property)
{
$id = $this->getResolvedProperty($property . '_id');
if ($id) {
return $this->getRelatedObject($property, $id);
}
return null;
}
public function supportsCustomVars()
{
return $this->supportsCustomVars;