当前位置: 首页>>代码示例>>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;未经允许,请勿转载。