Elgg
Version 2.3
|
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 () | |
{} More... | |
key () | |
{} More... | |
next () | |
{} More... | |
valid () | |
{} More... | |
count () | |
Count the total results available at this moment. More... | |
__get ($name) | |
Read a property. More... | |
__set ($name, $value) | |
Write a property. More... | |
Public Attributes | |
$callbackResult = null | |
Definition at line 73 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 ElggBatch::setIncrementOffset(). |
Definition at line 209 of file ElggBatch.php.
ElggBatch::__get | ( | $name | ) |
Read a property.
string | $name |
Definition at line 468 of file ElggBatch.php.
ElggBatch::__set | ( | $name, | |
$value | |||
) |
Write a property.
string | $name | |
mixed | $value |
Definition at line 486 of file ElggBatch.php.
ElggBatch::count | ( | ) |
Count the total results available at this moment.
As this performs a separate query, the count returned may not match the number of results you can fetch via iteration on a very active DB.
Definition at line 450 of file ElggBatch.php.
ElggBatch::current | ( | ) |
ElggBatch::key | ( | ) |
ElggBatch::next | ( | ) |
ElggBatch::reportIncompleteEntity | ( | \stdClass | $row | ) |
Tell the process that an entity was incomplete during a fetch.
\stdClass | $row | private |
Definition at line 262 of file ElggBatch.php.
ElggBatch::rewind | ( | ) |
Implements Iterator.
{}
Definition at line 375 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 364 of file ElggBatch.php.
ElggBatch::valid | ( | ) |
ElggBatch::$callbackResult = null |
Definition at line 164 of file ElggBatch.php.