src/LdapTools/Object/LdapObjectManager.php
public function delete(LdapObject $ldapObject, $recursively = false)
    {
        $this->dispatcher->dispatch(new LdapObjectEvent(Event::LDAP_OBJECT_BEFORE_DELETE, $ldapObject));
        $this->validateObject($ldapObject);

        $operation = new DeleteOperation($ldapObject->get('dn'));
        if ($recursively) {
            $operation->addControl((new LdapControl(LdapControlOid::SubTreeDelete))->setCriticality(true));
        }

        $this->connection->execute($operation);
        $this->dispatcher->dispatch(new LdapObjectEvent(Event::LDAP_OBJECT_AFTER_DELETE, $ldapObject));
    }
public function delete(LdapObject $ldapObject, $recursively = false)
    {
        $this->dispatcher->dispatch(new LdapObjectEvent(Event::LDAP_OBJECT_BEFORE_DELETE, $ldapObject));
        $this->validateObject($ldapObject);

        $operation = new DeleteOperation($ldapObject->get('dn'));
        if ($recursively) {
            $operation->addControl((new LdapControl(LdapControlOid::SubTreeDelete))->setCriticality(true));
        }

        $this->connection->execute($operation);
        $this->dispatcher->dispatch(new LdapObjectEvent(Event::LDAP_OBJECT_AFTER_DELETE, $ldapObject));
    }
public function delete ( LdapObject $ ldapObject , $ recursively = false ) { $ this -> dispatcher -> dispatch ( new LdapObjectEvent ( Event :: LDAP_OBJECT_BEFORE_DELETE , $ ldapObject ) ) ; $ this -> validateObject ( $ ldapObject ) ; $ operation = new DeleteOperation ( $ ldapObject -> get ( 'dn' ) ) ; if ( $ recursively ) { $ operation -> addControl ( ( new LdapControl ( LdapControlOid :: SubTreeDelete ) ) -> setCriticality ( true ) ) ; } $ this -> connection -> execute ( $ operation ) ; $ this -> dispatcher -> dispatch ( new LdapObjectEvent ( Event :: LDAP_OBJECT_AFTER_DELETE , $ ldapObject ) ) ; }
Removes an object from LDAP.

@param LdapObject $ldapObject
@param bool $recursively
Removes an object from LDAP .