Ejemplo n.º 1
0
 /**
  * Actually returns a Traversable object with the DriverCursor within.
  * If it does not exists yet, create it using the $collection, $command and
  * $params given.
  *
  * @return Traversable
  */
 protected function getCursor() : Traversable
 {
     if (!$this->cursor) {
         $params = $this->getConverter()->toMongoTypes($this->params);
         $driverCursor = $this->collection->{$this->command}(...$params);
         $this->cursor = new IteratorIterator($driverCursor);
         $this->cursor->rewind();
     }
     return $this->cursor;
 }
Ejemplo n.º 2
0
 /**
  * Rewind the Iterator to the first element
  * @link http://php.net/manual/en/iterator.rewind.php
  * @return void Any returned value is ignored.
  * @since 5.0.0
  */
 public function rewind()
 {
     $this->cursor->rewind();
 }