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 | |
Definition at line 58 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 174 of file ElggBatch.php.
| ElggBatch::current | ( | ) |
PHP Iterator Interface.
Definition at line 329 of file ElggBatch.php.
| ElggBatch::key | ( | ) |
PHP Iterator Interface.
Definition at line 339 of file ElggBatch.php.
| ElggBatch::next | ( | ) |
PHP Iterator Interface.
Definition at line 349 of file ElggBatch.php.
| ElggBatch::rewind | ( | ) |
Implements Iterator.
PHP Iterator Interface
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.
| bool | $increment Set to false when deleting data |
Definition at line 297 of file ElggBatch.php.
| ElggBatch::valid | ( | ) |
PHP Iterator Interface.
Definition at line 381 of file ElggBatch.php.
| ElggBatch::$callbackResult = null |
Definition at line 143 of file ElggBatch.php.
1.6.3