Example #1
0
 /**
  * Copy an entry to a new location
  *
  * The entry will be immediately copied.
  * Please note that only attributes you have
  * selected will be copied.
  *
  * @param Net_LDAP2_Entry $entry Entry object
  * @param string          $newdn  New FQF-DN of the entry
  *
  * @return Net_LDAP2_Error|Net_LDAP2_Entry Error Message or reference to the copied entry
  */
 public function copy($entry, $newdn)
 {
     if (!$entry instanceof Net_LDAP2_Entry) {
         return PEAR::raiseError('Parameter $entry is expected to be a Net_LDAP2_Entry object!');
     }
     $newentry = Net_LDAP2_Entry::createFresh($newdn, $entry->getValues());
     $result = $this->add($newentry);
     if ($result instanceof Net_LDAP2_Error) {
         return $result;
     } else {
         return $newentry;
     }
 }