Adldap\Connections\ConnectionInterface::delete PHP Method

delete() public method

Deletes an entry on the current connection.
public delete ( string $dn ) : boolean
$dn string
return boolean
    public function delete($dn);

Usage Example

Example #1
0
 /**
  * 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);
 }