From 3260fdbc4cb20224dbc939b7e33684610bf63d44 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Wed, 8 Apr 2009 18:51:38 +0200 Subject: [PATCH] Return all attributes in a hash. Fix initializing the cache if the object did not exist. --- .../Kolab_Server/lib/Horde/Kolab/Server/Object.php | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php index d390633b8..338384cba 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php @@ -468,11 +468,17 @@ class Horde_Kolab_Server_Object { $result = array(); - if (isset($attrs)) { - foreach ($attrs as $key) { - $value = $this->get($key); - $result[$key] = $value; - } + /** + * Return all supported attributes if no specific attributes were + * requested. + */ + if (empty($attrs)) { + $attrs = array_keys($this->attributes); + } + + foreach ($attrs as $key) { + $value = $this->get($key); + $result[$key] = $value; } return $result; @@ -615,8 +621,12 @@ class Horde_Kolab_Server_Object $result = $this->server->save($this->uid, $info, $this->exists()); - $this->_exists = true; - $this->_cache = array_merge($this->_cache, $info); + if (!$this->_exists) { + $this->_exists = true; + $this->_cache = $info; + } else { + $this->_cache = array_merge($this->_cache, $info); + } return $result; } -- 2.11.0