array('attributename' => 'single value', 'attributename' => array('value1', value2', value3'))
/** * Writes an LDIF file that describes an entry. * * @param Horde_Ldap_Entry $entry * * @throws Horde_Ldap_Exception */ protected function _writeEntry($entry) { // Fetch attributes for further processing. $entry_attrs = $entry->getValues(); // Sort and put objectclass attributes to first position. if ($this->_options['sort']) { ksort($entry_attrs); if (isset($entry_attrs['objectclass'])) { $oc = $entry_attrs['objectclass']; unset($entry_attrs['objectclass']); $entry_attrs = array_merge(array('objectclass' => $oc), $entry_attrs); } } // Write data. if (!$this->_versionWritten) { $this->writeVersion(); } $this->_writeDN($entry->dn()); foreach ($entry_attrs as $attr_name => $attr_values) { $this->_writeAttribute($attr_name, $attr_values); } $this->_finishEntry(); }
/** * Copies an entry to a new location. * * The entry will be immediately copied. Only attributes you have * selected will be copied. * * @param Horde_Ldap_Entry $entry An LDAP entry. * @param string $newdn New FQF-DN of the entry. * * @return Horde_Ldap_Entry The copied entry. * @throws Horde_Ldap_Exception */ public function copy($entry, $newdn) { if (!$entry instanceof Horde_Ldap_Entry) { throw new Horde_Ldap_Exception('Parameter $entry is expected to be a Horde_Ldap_Entry object'); } $newentry = Horde_Ldap_Entry::createFresh($newdn, $entry->getValues()); $this->add($newentry); return $newentry; }
/** * Add a new entryobject to a directory. * * @param Horde_Ldap_Entry $entry Horde_Ldap_Entry * * @return Horde_Ldap_Error|true Horde_Ldap_Error object or true */ public function add($entry) { $this->_checkBound(); $ldap_data = $this->toStorage($entry->getValues()); $guid = $entry->getDn(); $this->_data[$guid] = array('dn' => $guid, 'data' => array_merge($ldap_data, array('dn' => $guid))); }