mixed
DB_NestedSet::createRootNode
(
array
$values
,
integer
$id
= false
,
bool
$first
= false
,
string
$pos = NESE_MOVE_AFTER
)
Optionally it deletes the whole tree and creates one initial rootnode
+-- root1 [target]
|
+-- root2 [new]
|
+-- root3
$values
Hash with param => value pairs of the node (see $this->params)
$id
ID of target node (the rootnode after which the node should be inserted)
$first
Danger: Deletes and (re)inits the whole tree - sequences are reset
$pos
The position in which to insert the new node.
returns The node id or false on error
throws no exceptions thrown
This function can not be called statically.
Create rootnodes
<?php
require_once('DB/NestedSet.php');
$nestedSet =& DB_NestedSet::factory('DB', $dsn, $params);
$nestedSet->createRootNode(array('name' => 'rootnode'), false, true);
?>