Detailed Description

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

To persist its state use the PersistentIterator::save() method, to restore its state use the static PersistentIterator::load() method, which returns the loaded instance. States are identified by an unique id, which is provided after saving.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 25 of file PersistentIterator.php.

+ Inheritance diagram for PersistentIterator:

Public Member Functions

 __construct (PersistenceFacade $persistenceFacade, Session $session, ObjectId $oid, $aggregationKinds=array())
 
 save ()
 
 current ()
 
 key ()
 
 next ()
 
 rewind ()
 
 valid ()
 

Static Public Member Functions

static load ($persistenceFacade, $session, $uid)
 

Protected Member Functions

 addToQueue ($oidList, $depth)
 

Protected Attributes

 $_end
 
 $_oidList
 
 $_processedOidList
 
 $_currentOid
 
 $_startOid
 
 $_currentDepth
 
 $_aggregationKinds
 

Constructor & Destructor Documentation

__construct ( PersistenceFacade  $persistenceFacade,
Session  $session,
ObjectId  $oid,
  $aggregationKinds = array() 
)

Constructor.

Parameters
$persistenceFacade
$session
$oidThe oid 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 46 of file PersistentIterator.php.

Member Function Documentation

save ( )

Save the iterator state to the session.

Returns
A unique id to provide for load, see PersistentIterator::load()

Definition at line 66 of file PersistentIterator.php.

static load (   $persistenceFacade,
  $session,
  $uid 
)
static

Load an iterator state from the session.

Parameters
$persistenceFacade
$session
$uidThe unique id returned from the save method, see PersistentIterator::save()
Returns
PersistentIterator instance holding the saved state or null if unique id is not found

Definition at line 81 of file PersistentIterator.php.

current ( )

Return the current element.

Returns
ObjectId, the current object id

Definition at line 102 of file PersistentIterator.php.

key ( )

Return the key of the current element.

Returns
Number, the current depth

Definition at line 110 of file PersistentIterator.php.

next ( )

Move forward to next element.

Definition at line 117 of file PersistentIterator.php.

rewind ( )

Rewind the Iterator to the first element.

Definition at line 167 of file PersistentIterator.php.

valid ( )

Checks if current position is valid.

Definition at line 178 of file PersistentIterator.php.

addToQueue (   $oidList,
  $depth 
)
protected

Add oids to the processing queue.

Parameters
$oidListAn array of oids.
$depthThe depth of the oids in the tree.

Definition at line 187 of file PersistentIterator.php.

Member Data Documentation

$_end
protected

Definition at line 30 of file PersistentIterator.php.

$_oidList
protected

Definition at line 31 of file PersistentIterator.php.

$_processedOidList
protected

Definition at line 32 of file PersistentIterator.php.

$_currentOid
protected

Definition at line 33 of file PersistentIterator.php.

$_startOid
protected

Definition at line 34 of file PersistentIterator.php.

$_currentDepth
protected

Definition at line 35 of file PersistentIterator.php.

$_aggregationKinds
protected

Definition at line 36 of file PersistentIterator.php.