|
Elgg
Version 1.10
|
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. More... | |
| reportIncompleteEntity (\stdClass $row) | |
| Tell the process that an entity was incomplete during a fetch. More... | |
| setIncrementOffset ($increment=true) | |
| Increment the offset from the original options array? Setting to false is required for callbacks that delete rows. More... | |
| rewind () | |
| Implements Iterator. More... | |
| current () | |
| PHP Iterator Interface. More... | |
| key () | |
| PHP Iterator Interface. More... | |
| next () | |
| PHP Iterator Interface. More... | |
| valid () | |
| PHP Iterator Interface. More... | |
Public Attributes | |
| $callbackResult = null | |
Definition at line 57 of file ElggBatch.php.
| 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.
| 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 (). |
Definition at line 187 of file ElggBatch.php.
| ElggBatch::current | ( | ) |
PHP Iterator Interface.
Definition at line 374 of file ElggBatch.php.
| ElggBatch::key | ( | ) |
PHP Iterator Interface.
Definition at line 384 of file ElggBatch.php.
| ElggBatch::next | ( | ) |
PHP Iterator Interface.
Definition at line 394 of file ElggBatch.php.
| ElggBatch::reportIncompleteEntity | ( | \stdClass | $row | ) |
Tell the process that an entity was incomplete during a fetch.
| \stdClass | $row | @access private |
Definition at line 240 of file ElggBatch.php.
| ElggBatch::rewind | ( | ) |
Implements Iterator.
PHP Iterator Interface
Definition at line 356 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.
| bool | $increment | Set to false when deleting data |
Definition at line 342 of file ElggBatch.php.
| ElggBatch::valid | ( | ) |
PHP Iterator Interface.
Definition at line 426 of file ElggBatch.php.
| ElggBatch::$callbackResult = null |
Definition at line 142 of file ElggBatch.php.