IcingaObject: add helper for related objects

This commit is contained in:
Thomas Gelf 2016-02-17 16:03:07 +01:00
parent afe0bfb373
commit 7b6747ab67
1 changed files with 6 additions and 2 deletions

View File

@ -72,10 +72,14 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
}
protected function getRelatedObjectName($property, $id)
{
return $this->getRelatedObject($property, $id)->object_name;
}
protected function getRelatedObject($property, $id)
{
$class = $this->getRelationClass($property);
$object = $class::loadWithAutoIncId($id, $this->connection);
return $object->object_name;
return $class::loadWithAutoIncId($id, $this->connection);
}
public function supportsCustomVars()