From 7b6747ab670df7dc25824b647ac4c83a559f524c Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 17 Feb 2016 16:03:07 +0100 Subject: [PATCH] IcingaObject: add helper for related objects --- library/Director/Objects/IcingaObject.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php index ac8eaadf..8727fd5c 100644 --- a/library/Director/Objects/IcingaObject.php +++ b/library/Director/Objects/IcingaObject.php @@ -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()