public function testPresetUid() { $object = new Horde_Kolab_Storage_Object(); $object->setData(array('uid' => 'UID')); $this->assertEquals('UID', $object->getUid()); }
/** * Create a new object. * * @param array &$object The array that holds the object data. * @param boolean $raw True if the data to be stored has been provided in * raw format. * * @return string The ID of the new object or true in case the backend does * not support this return value. * * @throws Horde_Kolab_Storage_Exception In case an error occured while * saving the data. */ public function create(&$object, $raw = false) { if ($raw === false) { $writer = new Horde_Kolab_Storage_Object_Writer_Format(new Horde_Kolab_Format_Factory(), array('version' => $this->_version)); } else { $writer = new Horde_Kolab_Storage_Object_Writer_Raw(); } $storage_object = new Horde_Kolab_Storage_Object(); $storage_object->setDriver($this->_driver); $storage_object->setData($object); if (empty($object['uid'])) { $object['uid'] = $storage_object->getUid(); } $result = $storage_object->create($this->_folder, $writer, $this->getType()); if ($result === true) { $params = array(); } else { $params = array('changes' => array(Horde_Kolab_Storage_Folder_Stamp::ADDED => array($result => $storage_object), Horde_Kolab_Storage_Folder_Stamp::DELETED => array())); } $this->synchronize($params); return $result; }