本文整理汇总了PHP中MongoCursor::current方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoCursor::current方法的具体用法?PHP MongoCursor::current怎么用?PHP MongoCursor::current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoCursor
的用法示例。
在下文中一共展示了MongoCursor::current方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: current
/**
* Return the current element
* @return EMongoDocument
* @since v1.3.4
*/
public function current()
{
$document = $this->_cursor->current();
if (empty($document)) {
return $document;
}
return $this->_model->populateRecord($document);
}
示例2: current
/**
* (PHP 5 >= 5.0.0)<br/>
* Return the current element
* @link http://php.net/manual/en/iterator.current.php
* @return mixed Can return any type.
*/
public function current()
{
$collection = clone $this->collectionInstance;
$collection->writeAttributes((array) $this->cursor->current());
if ($this->fields) {
$collection->setCursorFields($this->fields);
}
if ($collection::isLazyLoadingEnabled()) {
$proxyClass = ProxyBuilder::getLazyLoadingClass(get_class($collection), Di::getDefault());
ProxyBuilder::assignProxyValues($proxyClass, $collection);
$collection = $proxyClass;
} else {
$collection->map();
}
return $collection;
}
示例3: current
/**
* Returns the current element
*
* @return array|object
*/
public function current()
{
$values = parent::current();
if (isset($values) && isset($this->collection) && $this->collection->getDocumentClass()) {
$values = $this->collection->asDocument($values, $this->lazy);
}
return $values;
}
示例4: current
public function current()
{
if ($this->collectionName === null) {
return new $this->objectType(parent::current());
} else {
return new $this->objectType($this->collectionName, parent::current());
}
}
示例5: current
/**
* Gets the active record for the current row
* @return EMongoDocument|mixed
* @throws EMongoException
*/
public function current()
{
if ($this->model === null) {
return $this->current = $this->cursor->current();
} else {
return $this->current = $this->model->populateRecord($this->cursor->current(), true, $this->partial);
}
}
示例6: current
/**
* Returns the current file
*
* @return MongoGridFSFile - The current file.
*/
public function current()
{
$current = parent::current();
if (!$current) {
return null;
}
return new MongoGridFSFile($this->gridfs, $current);
}
示例7: current
/**
* {@inheritdoc}
*
* @return array|Document
* @throws ODMException
* @throws DefinitionException
*/
public function current()
{
$fields = $this->cursor->current();
if (empty($this->class)) {
return $fields;
}
return $fields ? $this->odm->document($this->class, $fields) : null;
}
示例8: current
/**
* Iterator::current
* return current specific object
*
* @return MongoObject
* @throws Exception
*/
public function current()
{
$documentData = $this->myResultCursor->current();
/** @var MongoObject $document */
$document = $this->container->getInstanceOf($this->classMapInterface->getClassForResult($this->collection, $documentData));
$document->setCollection($this->collection);
$document->loadFromArray($documentData);
return $document;
}
示例9: current
/**
* Iterator interface current. Return a model object
* with cursor document. (used in foreach)
*
* @return mixed
*/
public function current()
{
$model = clone $this->model;
$document = $this->cursor->current();
if ($model->parseDocument($document)) {
return $model;
}
return false;
}
示例10: current
/**
* Wrapper method for MongoCursor::current().
*
* @see http://php.net/manual/en/iterator.current.php
* @see http://php.net/manual/en/mongocursor.current.php
* @return array|null
*/
public function current()
{
$current = $this->mongoCursor->current();
if ($current instanceof \MongoGridFSFile) {
$document = $current->file;
$document['file'] = new GridFSFile($current);
$current = $document;
}
return $current;
}
示例11: rewind
/**
* @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;
}
示例12: 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;
}
示例13: current
/**
* Returns the current element
*
* @since 0.3.0
*
* See [\Iterator::current]
*
* @link http://www.php.net/manual/en/mongocursor.current.php \MongoCursor::current
*
* @return array
*/
public function current()
{
$data = $this->cursor->current();
if (isset($this->benchmark)) {
// Stop the benchmark
Profiler::stop($this->benchmark);
// Clean benchmark token
$this->benchmark = null;
}
if (!$this->model) {
return $data;
}
$model = clone $this->model;
return $model->loadValues($data ?: array(), true);
}
示例14: current
/**
* @return Model
*/
public function current()
{
return $this->load_model(parent::current());
}
示例15: current
/**
* (PHP 5 >= 5.0.0)<br/>
* Return the current element
* @link http://php.net/manual/en/iterator.current.php
* @return mixed Can return any type.
*/
public function current()
{
return $this->cursor->current();
}