當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MongoCursor::reset方法代碼示例

本文整理匯總了PHP中MongoCursor::reset方法的典型用法代碼示例。如果您正苦於以下問題:PHP MongoCursor::reset方法的具體用法?PHP MongoCursor::reset怎麽用?PHP MongoCursor::reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MongoCursor的用法示例。


在下文中一共展示了MongoCursor::reset方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * The cursor constructor
  * @param string|EMongoDocument $modelClass - The class name for the active record
  * @param array|MongoCursor|EMongoCriteria $criteria -  Either a condition array (without sort,limit and skip) or a MongoCursor Object
  * @param array $fields
  */
 public function __construct($modelClass, $criteria = array(), $fields = array())
 {
     // If $fields has something in it
     if (!empty($fields)) {
         $this->partial = true;
     }
     if (is_string($modelClass)) {
         $this->modelClass = $modelClass;
         $this->model = EMongoDocument::model($this->modelClass);
     } elseif ($modelClass instanceof EMongoDocument) {
         $this->modelClass = get_class($modelClass);
         $this->model = $modelClass;
     }
     if ($criteria instanceof MongoCursor) {
         $this->cursor = $criteria;
         $this->cursor->reset();
     } elseif ($criteria instanceof EMongoCriteria) {
         $this->criteria = $criteria;
         $this->cursor = $this->model->getCollection()->find($criteria->condition, $criteria->project)->sort($criteria->sort);
         if ($criteria->skip > 0) {
             $this->cursor->skip($criteria->skip);
         }
         if ($criteria->limit > 0) {
             $this->cursor->limit($criteria->limit);
         }
     } else {
         // Then we are doing an active query
         $this->criteria = $criteria;
         $this->cursor = $this->model->getCollection()->find($criteria, $fields);
     }
 }
開發者ID:pvassiliou,項目名稱:MongoYii,代碼行數:37,代碼來源:EMongoCursor.php

示例2: row

 /**
  * Returns the document at the specified index as an object
  *
  * @since v1.0.0
  */
 public function row($index = 0, $class = NULL, $as_object = FALSE)
 {
     $size = $this->_cursor->count();
     $this->_cursor->reset();
     $res = array();
     for ($i = 0; $i < $size; $i++) {
         $this->_cursor->next();
         if ($i == $index && $index <= $size) {
             $res = $as_object ? (object) $this->_cursor->current() : $this->_cursor->current();
             break;
         }
     }
     return $res;
 }
開發者ID:AnthemiusGuo,項目名稱:managerproject,代碼行數:19,代碼來源:Cimongo_cursor.php

示例3: reset

 /**
  * Wrapper method for MongoCursor::reset().
  *
  * @see http://php.net/manual/en/iterator.reset.php
  * @see http://php.net/manual/en/mongocursor.reset.php
  */
 public function reset()
 {
     $this->mongoCursor->reset();
 }
開發者ID:ne0h12,項目名稱:mongodb,代碼行數:10,代碼來源:Cursor.php

示例4: setCursor

 /**
  *  Set Cursor
  *
  *  This method receive a MongoCursor and make
  *  it iterable. 
  *
  *  @param MongoCursor $obj 
  *
  *  @return void
  */
 protected final function setCursor(MongoCursor $obj)
 {
     $this->_cursor = $obj;
     $obj->reset();
     $this->setResult($obj->getNext());
 }
開發者ID:284099857,項目名稱:ActiveMongo,代碼行數:16,代碼來源:ActiveMongo.php

示例5: reset

 /**
  * Clears the cursor
  * @link http://www.php.net/manual/en/mongocursor.reset.php
  * @return $this
  */
 public function reset()
 {
     $this->cursor->reset();
     return $this;
 }
開發者ID:Nkelliny,項目名稱:Framework,代碼行數:10,代碼來源:MongoCursor.php

示例6: reset

 /**
  * 清除遊標
  * @return null
  */
 public function reset()
 {
     return $this->oMongoCursor->reset();
 }
開發者ID:diandengs,項目名稱:RechoPHP,代碼行數:8,代碼來源:class.Mumongo.php


注:本文中的MongoCursor::reset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。