DB_NestedSet::createSubNode
DB_NestedSet::createSubNode() – Creates a subnode
Synopsis
require_once 'DB/NestedSet.php';
mixed
DB_NestedSet::createSubNode
(
integer
$id
,
array
$values
)
Description
+-- root1
|
+-\ root2 [target]
| |
| |-- subnode1 [new]
|
+-- root3
Parameter
-
integer
$id
-
Parent node ID
-
array
$values
-
Hash with param => value pairs of the node (see $this->params)
Return value
returns The node id or false on error
Throws
throws no exceptions thrown
Note
This function can not be called statically.
Example
Create subnodes
<?php
require_once('DB/NestedSet.php');
$nestedSet =& DB_NestedSet::factory('DB', $dsn, $params);
$parent = $nestedSet->createRootNode(array('name' => 'rootnode'), false, true);
$nestedSet->createSubNode($parent, array('name' => "node"));
?>