ElggBatch Class Reference

List of all members.

Public Member Functions

 __construct ($getter, $options, $callback=null, $chunk_size=25, $inc_offset=true)
 Batches operations on any elgg_get_*() or compatible function that supports an options array.
 setIncrementOffset ($increment=true)
 Increment the offset from the original options array? Setting to false is required for callbacks that delete rows.
 rewind ()
 Implements Iterator.
 current ()
 PHP Iterator Interface.
 key ()
 PHP Iterator Interface.
 next ()
 PHP Iterator Interface.
 valid ()
 PHP Iterator Interface.

Public Attributes

 $callbackResult = null

Detailed Description

Definition at line 58 of file ElggBatch.php.


Constructor & Destructor Documentation

ElggBatch::__construct ( getter,
options,
callback = null,
chunk_size = 25,
inc_offset = true 
)

Batches operations on any elgg_get_*() or compatible function that supports an options array.

Instead of returning all objects in memory, it goes through $chunk_size objects, then requests more from the server. This avoids OOM errors.

Parameters:
string $getter The function used to get objects. Usually an elgg_get_*() function, but can be any valid PHP callback.
array $options The options array to pass to the getter function. If limit is not set, 10 is used as the default. In most cases that is not what you want.
mixed $callback An optional callback function that all results will be passed to upon load. The callback needs to accept $result, $getter, $options.
int $chunk_size The number of entities to pull in before requesting more. You have to balance this between running out of memory in PHP and hitting the db server too often.
bool $inc_offset Increment the offset on each fetch. This must be false for callbacks that delete rows. You can set this after the object is created with {
See also:
ElggBatch::setIncrementOffset()}.

Definition at line 174 of file ElggBatch.php.


Member Function Documentation

ElggBatch::current (  ) 

PHP Iterator Interface.

See also:
Iterator::current()
Returns:
mixed

Definition at line 329 of file ElggBatch.php.

ElggBatch::key (  ) 

PHP Iterator Interface.

See also:
Iterator::key()
Returns:
int

Definition at line 339 of file ElggBatch.php.

ElggBatch::next (  ) 

PHP Iterator Interface.

See also:
Iterator::next()
Returns:
mixed

Definition at line 349 of file ElggBatch.php.

ElggBatch::rewind (  ) 

Implements Iterator.

PHP Iterator Interface

See also:
Iterator::rewind()
Returns:
void

Definition at line 311 of file ElggBatch.php.

ElggBatch::setIncrementOffset ( increment = true  ) 

Increment the offset from the original options array? Setting to false is required for callbacks that delete rows.

Parameters:
bool $increment Set to false when deleting data
Returns:
void

Definition at line 297 of file ElggBatch.php.

ElggBatch::valid (  ) 

PHP Iterator Interface.

See also:
Iterator::valid()
Returns:
bool

Definition at line 381 of file ElggBatch.php.


Member Data Documentation

ElggBatch::$callbackResult = null

Definition at line 143 of file ElggBatch.php.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations
Generated on Thu May 23 00:01:25 2013 for Elgg by  doxygen 1.6.3