Detailed Description

NodeIterator is used to iterate over a tree/list built of Nodes using a Depth-First-Algorithm.

Classes used with the NodeIterator must implement the getChildren() and getOID() methods.

The following example shows the usage:

// load the node with depth 10
$node = ObjectFactory::getInstance('persistenceFacade')->load(new ObjectId('Page', 300), 10);
// iterate over all children
$it = new NodeIterator($node);
foreach($it as $oid => $obj) {
echo("current object id: ".$oid);
echo("current object: ".$obj);
}
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 36 of file NodeIterator.php.

+ Inheritance diagram for NodeIterator:

Public Member Functions

 __construct ($node, $aggregationKinds=array())
 
 current ()
 
 key ()
 
 next ()
 
 rewind ()
 
 valid ()
 

Protected Member Functions

 addToQueue ($nodeList)
 

Protected Attributes

 $_end
 
 $_nodeList
 
 $_processedOidList
 
 $_currentNode
 
 $_startNode
 
 $_aggregationKinds
 

Constructor & Destructor Documentation

__construct (   $node,
  $aggregationKinds = array() 
)

Constructor.

Parameters
$nodeThe node to start from.
$aggregationKindsArray of aggregation kind values of relations to follow possible values: 'none', 'shared', 'composite'. Empty array means all (default: empty)

Definition at line 51 of file NodeIterator.php.

Member Function Documentation

current ( )

Return the current element.

Returns
Node instance

Definition at line 64 of file NodeIterator.php.

key ( )

Return the key of the current element.

Returns
String, the serialized object id

Definition at line 72 of file NodeIterator.php.

next ( )

Move forward to next element.

Definition at line 79 of file NodeIterator.php.

rewind ( )

Rewind the Iterator to the first element.

Definition at line 126 of file NodeIterator.php.

valid ( )

Checks if current position is valid.

Definition at line 136 of file NodeIterator.php.

addToQueue (   $nodeList)
protected

Add nodes to the processing queue.

Parameters
$nodeListAn array of nodes.

Definition at line 144 of file NodeIterator.php.

Member Data Documentation

$_end
protected

Definition at line 38 of file NodeIterator.php.

$_nodeList
protected

Definition at line 39 of file NodeIterator.php.

$_processedOidList
protected

Definition at line 40 of file NodeIterator.php.

$_currentNode
protected

Definition at line 41 of file NodeIterator.php.

$_startNode
protected

Definition at line 42 of file NodeIterator.php.

$_aggregationKinds
protected

Definition at line 43 of file NodeIterator.php.