Files
mongo-php-driver/docs/api/MongoDB/Query/QueryCursor.php
Jeremy Mikola 749b2d391a Implement review feedback
Some highlights: fix class/interface syntax; additional class/method docs; Manager convenience methods; more value objects.
2014-06-13 03:52:26 -04:00

67 lines
1.4 KiB
PHP

<?php
namespace MongoDB\Query;
use MongoDB\Cursor;
use MongoDB\CursorId;
/**
* Cursor implementation that is returned after executing a Query.
*
* The iteration and internal logic is very similar to CommandCursor, so both
* classes should likely share code. The documents in the OP_REPLY message
* returned by the original OP_QUERY is comparable to the first batch of a
* command cursor, in that both may be available at the time the cursor is
* constructed.
*/
final class QueryCursor implements Cursor
{
private $server;
private $batchSize;
private $cursorId;
/**
* @param Server $server
* @param CursorId $cursorId
*/
public function __construct(Server $server, CursorId $cursorId)
{
$this->server = $server;
$this->cursorId = $cursorId;
}
// Iterator methods...
/**
* @see Cursor::getId()
*/
public function getId()
{
return $this->cursorId;
}
/**
* @see Cursor::getServer()
*/
public function getServer()
{
return $this->server;
}
/**
* @see Cursor::isDead()
*/
public function isDead()
{
// Return whether the cursor is exhausted and has no more results
}
/**
* @see Cursor::setBatchSize()
*/
public function setBatchSize($batchSize)
{
$this->batchSize = (integer) $batchSize;
}
}