Detailed Description

PersistentIterator is used to iterate over a tree/list built of persistent objects 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.

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

Definition at line 24 of file PersistentIterator.php.

+ Inheritance diagram for PersistentIterator:

Public Member Functions

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

Static Public Member Functions

static reset ($id, Session $session)
 
static load ($id, $persistenceFacade, $session)
 

Protected Member Functions

 addToQueue ($oidList, $depth)
 

Protected Attributes

 $end
 
 $oidList
 
 $processedOidList
 
 $currentOid
 
 $startOid
 
 $currentDepth
 
 $aggregationKinds
 

Constructor & Destructor Documentation

__construct (   $id,
PersistenceFacade  $persistenceFacade,
Session  $session,
ObjectId  $oid,
  $aggregationKinds = [] 
)

Constructor.

Parameters
$idThe unique iterator id used to store iterator's the state in the session
$persistenceFacade
$session
$oidThe object id 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 47 of file PersistentIterator.php.

Member Function Documentation

save ( )

Save the iterator state to the session.

Definition at line 68 of file PersistentIterator.php.

static reset (   $id,
Session  $session 
)
static

Reset the iterator with the given id.

Parameters
$idThe iterator id
$session

Definition at line 79 of file PersistentIterator.php.

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

Load an iterator state from the session.

Parameters
$idThe unique iterator id used to store iterator's the state in the session
$persistenceFacade
$session
Returns
PersistentIterator instance holding the saved state or null if unique id is not found

Definition at line 90 of file PersistentIterator.php.

current ( )

Return the current element.

Returns
ObjectId, the current object id

Definition at line 111 of file PersistentIterator.php.

key ( )

Return the key of the current element.

Returns
Number, the current depth

Definition at line 119 of file PersistentIterator.php.

next ( )

Move forward to next element.

Definition at line 126 of file PersistentIterator.php.

rewind ( )

Rewind the Iterator to the first element.

Definition at line 176 of file PersistentIterator.php.

valid ( )

Checks if current position is valid.

Definition at line 187 of file PersistentIterator.php.

addToQueue (   $oidList,
  $depth 
)
protected

Add object ids to the processing queue.

Parameters
$oidListAn array of object ids.
$depthThe depth of the object ids in the tree.

Definition at line 196 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.