Skip to content

Instantly share code, notes, and snippets.

@0xPr0xy
Created March 3, 2016 12:52
Show Gist options
  • Save 0xPr0xy/8a396aab049a55842fb1 to your computer and use it in GitHub Desktop.
Save 0xPr0xy/8a396aab049a55842fb1 to your computer and use it in GitHub Desktop.
Cursor.php
/**
* Wrapper method for MongoCursor::current().
*
* @see http://php.net/manual/en/iterator.current.php
* @see http://php.net/manual/en/mongocursor.current.php
* @return array|null
*/
public function current()
{
$current = $this->mongoCursor->current();
if ($current instanceof \MongoGridFSFile) {
$document = $current->file;
$document['file'] = new GridFSFile($current);
$current = $document;
}
return $current;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment