From: Gunnar Wrobel
Date: Wed, 29 Apr 2009 08:20:06 +0000 (+0200) Subject: Support direct deletion. Add action support. Fix testing for ID changes when modifyin... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=36701eac7eca759ebd089ed7c78a286837846996;p=horde.git Support direct deletion. Add action support. Fix testing for ID changes when modifying objects. --- diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php index b474d7317..02f33a3d3 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php @@ -666,6 +666,18 @@ class Horde_Kolab_Server_Object } /** + * Delete this object. + * + * @return boolean True if deleting the object succeeded. + * + * @throws Horde_Kolab_Server_Exception + */ + public function delete() + { + return $this->server->delete($this->uid); + } + + /** * Prepare the object information before saving. * * @param array $info The information about the object. @@ -768,13 +780,15 @@ class Horde_Kolab_Server_Object } /* Check for potential renaming of the object here */ - $new_info = array_merge($this->_cache, $info); - $new_uid = $this->server->generateServerUid(get_class($this), - $this->generateId($new_info), - $new_info); - if ($new_uid != $this->uid) { - $this->server->rename($this->uid, $new_uid); - $this->uid = $new_uid; + $new_id = $this->generateId($info); + if ($new_id !== false) { + $new_uid = $this->server->generateServerUid(get_class($this), + $new_id, + $new_info); + if ($new_uid != $this->uid) { + $this->server->rename($this->uid, $new_uid); + $this->uid = $new_uid; + } } } @@ -960,4 +974,14 @@ class Horde_Kolab_Server_Object return self::uidFromResult($data, Horde_Kolab_Server_Object::RESULT_MANY); } + /** + * Returns the set of actions supported by this object type. + * + * @return array An array of supported actions. + */ + public function getActions() + { + return array(); + } + };