/** * Modify existing object data. * * @param Horde_Kolab_Server_Object $object The object to be modified. * @param array $data The attributes of the object * to be stored. * * @return NULL * * @throws Horde_Kolab_Server_Exception */ public function save(Horde_Kolab_Server_Object_Interface $object, array $data) { $changes = new Horde_Kolab_Server_Ldap_Changes($object, $data); try { $entry = $this->_conn->getWrite()->getEntry($object->getGuid(), array_keys($data)); $this->_conn->getWrite()->modify($entry, $changes->getChangeset()); } catch (Horde_Ldap_Exception $e) { throw new Horde_Kolab_Server_Exception('Saving failed!', Horde_Kolab_Server_Exception::SYSTEM, $e); } }
public function testMethodGetchangesetHasResultArrayTheNewValuesAsAddedAndTheRemovedValuesAsDeleted() { $object = $this->getMock('Horde_Kolab_Server_Object_Interface'); $object->expects($this->once())->method('readInternal')->will($this->returnValue(array('value' => array('a', 'b', 'c')))); $changes = new Horde_Kolab_Server_Ldap_Changes($object, array('value' => array('b', 'c', 'd'))); $this->assertEquals(array('add' => array('value' => array('d')), 'delete' => array('value' => array('a'))), $changes->getChangeset()); }