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/classes | |
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/classes')
-rw-r--r-- | engine/classes/ElggBatch.php | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/engine/classes/ElggBatch.php b/engine/classes/ElggBatch.php index eb93b0f5d..34520f2bc 100644 --- a/engine/classes/ElggBatch.php +++ b/engine/classes/ElggBatch.php @@ -150,6 +150,13 @@ class ElggBatch private $incrementOffset = true; /** + * Entities that could not be instantiated during a fetch + * + * @var stdClass[] + */ + private $incompleteEntities = array(); + + /** * Batches operations on any elgg_get_*() or compatible function that supports * an options array. * @@ -222,6 +229,17 @@ class ElggBatch } /** + * Tell the process that an entity was incomplete during a fetch + * + * @param stdClass $row + * + * @access private + */ + public function reportIncompleteEntity(stdClass $row) { + $this->incompleteEntities[] = $row; + } + + /** * Fetches the next chunk of results * * @return bool @@ -265,16 +283,16 @@ class ElggBatch $current_options = array( 'limit' => $limit, - 'offset' => $offset + 'offset' => $offset, + '__ElggBatch' => $this, ); $options = array_merge($this->options, $current_options); - $getter = $this->getter; - if (is_string($getter)) { - $this->results = $getter($options); - } else { - $this->results = call_user_func_array($getter, array($options)); + $this->incompleteEntities = array(); + $this->results = call_user_func_array($this->getter, array($options)); + if ($this->incompleteEntities) { + // @todo what to do here? } if ($this->results) { |