/** * Deletes the current entry. * * @return bool * * @throws EntryDoesNotExistException * @throws AdldapException */ public function delete() { $dn = $this->getDn(); if (!$this->exists) { // Make sure the record exists before we can delete it $message = 'Entry does not exist in active directory.'; throw new EntryDoesNotExistException($message); } else { if (is_null($dn) || empty($dn)) { // If the record exists but the DN attribute does // not exist, we can't process a delete. $message = 'Unable to delete. The current entry does not have a distinguished name present.'; throw new AdldapException($message); } } return $this->connection->delete($dn); }