NodeValueIterator Class Reference

Detailed Description

NodeValueIterator is used to iterate over all persistent values of a Node (not including relations).

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 values
$it = new NodeValueIterator($node);
foreach($it as $name => $value) {
echo("current attribute name: ".$name);
echo("current attribute value: ".$value);
}
// iterate over all values with access to the current object
for($it->rewind(); $it->valid(); $it->next()) {
echo("current object: ".$it->currentNode());
echo("current attribute name: ".$it->key());
echo("current attribute value: ".$it->current());
}
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 43 of file NodeValueIterator.php.

+ Inheritance diagram for NodeValueIterator:

Public Member Functions

 __construct ($node, $recursive)
 
 current ()
 
 key ()
 
 next ()
 
 rewind ()
 
 valid ()
 
 currentNode ()
 

Protected Attributes

 $end
 
 $recursive
 
 $nodeIterator
 
 $currentAttributes
 
 $currentAttribute
 

Constructor & Destructor Documentation

__construct (   $node,
  $recursive 
)

Constructor.

Parameters
$nodeThe node to start from.
$recursiveBoolean whether the iterator should also process child nodes

Definition at line 56 of file NodeValueIterator.php.

Member Function Documentation

current ( )

Return the current element.

Returns
Value of the current attribute

Definition at line 68 of file NodeValueIterator.php.

key ( )

Return the key of the current element.

Returns
String, the name of the current attribute

Definition at line 77 of file NodeValueIterator.php.

next ( )

Move forward to next element.

Definition at line 84 of file NodeValueIterator.php.

rewind ( )

Rewind the Iterator to the first element.

Definition at line 111 of file NodeValueIterator.php.

valid ( )

Checks if current position is valid.

Definition at line 121 of file NodeValueIterator.php.

currentNode ( )

Get the current node.

Returns
Node instance

Definition at line 129 of file NodeValueIterator.php.

Member Data Documentation

$end
protected

Definition at line 45 of file NodeValueIterator.php.

$recursive
protected

Definition at line 46 of file NodeValueIterator.php.

$nodeIterator
protected

Definition at line 47 of file NodeValueIterator.php.

$currentAttributes
protected

Definition at line 48 of file NodeValueIterator.php.

$currentAttribute
protected

Definition at line 49 of file NodeValueIterator.php.