From 356a3b04848b04eb2bb8be3c3fd457c492f9cb3f Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 26 Mar 2017 19:00:03 -0400 Subject: Add functions for object hierarchy mgmt Added to object class, functions: setOwner, getParent, setParent. --- app/class/object.class.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'app/class/object.class.php') diff --git a/app/class/object.class.php b/app/class/object.class.php index ee3dc21..1fbe923 100644 --- a/app/class/object.class.php +++ b/app/class/object.class.php @@ -74,6 +74,34 @@ class object extends table return new user($this->owner); } + /* + * Update the owner of this object + */ + public function setOwner(agent $owner) : void + { + $this->owner = $owner->guid; + } + + /* + * Get the parent of this object. If this object does not have a + * parent, NULL will be returned. + */ + public function getParent() : ?object + { + if (!isset($this->parent) || $this->parent == "") + return NULL; + + return new object($this->parent); + } + + /* + * Update the parent of this object + */ + public function setParent(object $parent) : void + { + $this->parent = $parent->guid; + } + /* * Get an array of all members of this object */ -- cgit v1.2.3