Beispiel #1
0
 /**
  * @throws Exception\RuntimeException
  * @return void
  */
 public function rewind()
 {
     //        if ( $this -> statementMode == self::STATEMENT_MODE_FORWARD && $this -> position > 0 )
     //        {
     //            throw new Exception\RuntimeException(
     //            'This result is a forward only result set, calling rewind() after moving forward is not supported'
     //            );
     //        }
     $this->resource->rewind();
     $this->currentData = $this->resource->current();
     $this->currentComplete = true;
     $this->position = 0;
 }
 /**
  *
  * @return \MongoCursor
  */
 private function getCursor()
 {
     if ($this->cursor) {
         return $this->cursor;
     }
     $this->cursor = $this->collection->getMongoCollection()->find($this->expression->toArray(), $this->fields);
     if ($this->skip) {
         $this->cursor->skip($this->skip);
     }
     if ($this->limit) {
         $this->cursor->limit($this->limit);
     }
     if ($this->options['batchSize']) {
         $this->cursor->batchSize($this->options['batchSize']);
     }
     if ($this->options['clientTimeout']) {
         $this->cursor->timeout($this->options['clientTimeout']);
     }
     if ($this->options['serverTimeout']) {
         $this->cursor->maxTimeMS($this->options['clientTimeout']);
     }
     if ($this->sort) {
         $this->cursor->sort($this->sort);
     }
     if ($this->hint) {
         $this->cursor->hint($this->hint);
     }
     // log request
     if ($this->client->hasLogger()) {
         $this->client->getLogger()->debug(get_called_class() . ': ' . json_encode(array('collection' => $this->collection->getName(), 'query' => $this->expression->toArray(), 'project' => $this->fields, 'sort' => $this->sort)));
     }
     $this->cursor->rewind();
     // define read preferences
     if ($this->readPreference) {
         $this->cursor->setReadPreference($this->readPreference['type'], $this->readPreference['tagsets']);
     }
     return $this->cursor;
 }
Beispiel #3
0
 /**
  * Rewind the Iterator to the first element
  * @return void
  * @since v1.3.4
  */
 public function rewind()
 {
     $this->_cursor->rewind();
 }
Beispiel #4
0
 /**
  * Reset the MongoCursor to the beginning
  * @return EMongoCursor
  */
 public function rewind()
 {
     $this->cursor->rewind();
     return $this;
 }
Beispiel #5
0
 /**
  * Required for Iterator Interface
  * Runs the query on the database and rewinds the cursor to
  */
 public function rewind()
 {
     $this->runQry();
     $this->cursor->rewind();
 }
Beispiel #6
0
 /**
  * {@inheritdoc}
  */
 public function rewind()
 {
     $this->mongoCursor->rewind();
 }
Beispiel #7
0
 /**
  * rewind.
  */
 public function rewind()
 {
     $this->logQuery();
     return parent::rewind();
 }
Beispiel #8
0
 /**
  * Iterator::rewind
  */
 public function rewind()
 {
     $this->myResultCursor->rewind();
 }
Beispiel #9
0
 /**
  * Iterator interface rewind (used in foreach)
  *
  */
 public function rewind()
 {
     $this->cursor->rewind();
     $this->position = 0;
 }
Beispiel #10
0
 /**
  * 把游标指到第一条记录
  * @return null
  */
 public function rewind()
 {
     return $this->oMongoCursor->rewind();
 }