From 26621f5ab1db2f4faa9fe4c7be5fdb5b417bbd3c Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 8 Jun 2015 13:02:09 +0200 Subject: [PATCH] IcingaObject: add generic helper methods --- library/Director/Objects/IcingaObject.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php index 488e062d..6d522fb6 100644 --- a/library/Director/Objects/IcingaObject.php +++ b/library/Director/Objects/IcingaObject.php @@ -10,6 +10,25 @@ abstract class IcingaObject extends DbObject protected $autoincKeyName = 'id'; + protected $supportsCustomVars = false; + + public function supportsCustomVars() + { + return $this->supportsCustomVars; + } + + public function isTemplate() + { + return property_exists($this, 'object_type') + && $this->object_type === 'template'; + } + + public function isApplyRule() + { + return property_exists($this, 'object_type') + && $this->object_type === 'apply'; + } + public function onInsert() { DirectorActivityLog::logCreation($this, $this->connection);