/** * Deletes a node from the Ldap store * * @param Node $node Node to delete * @param boolean $isRecursive Whether to delete node with its children (Default: false) * * @return void * * @throws DeletionException If node to delete has some children and recursion disabled */ public function delete(Node $node, $isRecursive = false) { if (!$node->isHydrated()) { $node = $this->getNode($node->getDn()); } $children = $this->getChildrenNodes($node); if (count($children) > 0) { if (!$isRecursive) { throw new DeleteException(sprintf('%s cannot be deleted - it has some children left', $node->getDn())); } foreach ($children as $child) { $this->delete($child, true); } } $this->connection->deleteEntry($node->getDn()); }