Path

ez components / documentation / api reference / 1.1.1 / persistentobject


eZ Components 1.1.1

PersistentObject: ezcPersistentFindIterator

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcPersistentFindIterator

This class provides functionality to iterate over a database result set in the form of persistent objects. [source]

Implemented Interfaces

  • Iterator (internal interface)

ezcPersistentFindIterator only instantiates one object which is reused for each iteration. This saves memory and is faster than fetching and instantiating the result set in one go.
Note that if you are using MySQL you need to iterate through the complete result set of the iterator. This is because of a limitation in PHP.

Method Summary

public ezcPersistentFindIterator __construct( $stmt, $def )
Initializes the iterator with the statement $stmt and the definition $def..
public object current( )
Returns the current object of this iterator.
public null key( )
Returns null.
public object next( )
Returns the next persistent object in the result set.
public void rewind( )
Sets the iterator to point to the first object in the result set.
public bool valid( )
Returns true if there is a current object.

Methods

__construct

ezcPersistentFindIterator __construct( $stmt, ezcPersistentObjectDefinition $def )
Initializes the iterator with the statement $stmt and the definition $def..
The statement $stmt must be executed but not used to retrieve any results yet. The iterator will return objects with they persistent object type provided by $def.

Parameters

Name Type Description
$stmt PDOStatement  
$def ezcPersistentObjectDefinition  

current

object current( )
Returns the current object of this iterator.
Returns null if there is no current object.

key

null key( )
Returns null.
Persistent objects do not have a key. Hence, this method always returns null.

next

object next( )
Returns the next persistent object in the result set.
The next object is set to the current object of the iterator. Returns null and sets the current object to null if there are no more results in the result set.

rewind

void rewind( )
Sets the iterator to point to the first object in the result set.

valid

bool valid( )
Returns true if there is a current object.

Last updated: Thu, 01 Nov 2007