diff options
author | Steve Clay <steve@mrclay.org> | 2013-06-03 17:02:33 -0400 |
---|---|---|
committer | Steve Clay <steve@mrclay.org> | 2013-06-03 17:02:33 -0400 |
commit | 35acc4a297de7660a191d4e7f9d3e8d55561885a (patch) | |
tree | 10a9ab4e9fc067cde92948597ffbfdce673af57d /engine/lib/entities.php | |
parent | 50dee6fe09a1f600089b1684f6f8f91599c365a1 (diff) | |
download | elgg-35acc4a297de7660a191d4e7f9d3e8d55561885a.tar.gz elgg-35acc4a297de7660a191d4e7f9d3e8d55561885a.tar.bz2 |
Refs #5357: Introduces ElggBatch awareness of incomplete entities during fetch
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r-- | engine/lib/entities.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 5cfeca6f8..b7f8c1466 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -891,6 +891,8 @@ function elgg_get_entities(array $options = array()) { 'joins' => array(), 'callback' => 'entity_row_to_elggstar', + + '__ElggBatch' => null, ); $options = array_merge($defaults, $options); @@ -1008,7 +1010,7 @@ function elgg_get_entities(array $options = array()) { } if ($options['callback'] === 'entity_row_to_elggstar') { - $dt = _elgg_fetch_entities_from_sql($query); + $dt = _elgg_fetch_entities_from_sql($query, $options['__ElggBatch']); } else { $dt = get_data($query, $options['callback']); } @@ -1043,13 +1045,14 @@ function elgg_get_entities(array $options = array()) { /** * Return entities from an SQL query generated by elgg_get_entities. * - * @param string $sql + * @param string $sql + * @param ElggBatch $batch * @return ElggEntity[] * * @access private * @throws LogicException */ -function _elgg_fetch_entities_from_sql($sql) { +function _elgg_fetch_entities_from_sql($sql, ElggBatch $batch = null) { static $plugin_subtype; if (null === $plugin_subtype) { $plugin_subtype = get_subtype_id('object', 'plugin'); @@ -1126,6 +1129,11 @@ function _elgg_fetch_entities_from_sql($sql) { } catch (IncompleteEntityException $e) { // don't let incomplete entities throw fatal errors unset($rows[$i]); + + // report incompletes to the batch process that spawned this query + if ($batch) { + $batch->reportIncompleteEntity($row); + } } } } |