PHP Класс Mongolid\Cursor\EmbeddedCursor

By doing this we can use 'sort', 'skip', 'limit' and others after calling 'where'. Because the mongodb library's MongoDB\Cursor is much more limited (in that regard) than the old driver MongoCursor.
Наследование: implements Mongolid\Cursor\CursorInterface
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$entityClass string Entity class that will be returned while iterating.

Защищенные свойства (Protected)

Свойство Тип Описание
$items array The actual array of embedded documents.

Открытые методы

Метод Описание
__construct ( string $entityClass, array $items )
all ( ) : array Convert the cursor instance to an array of Items.
count ( ) : integer Counts the number of results for this cursor.
current ( ) : mixed Iterator interface current. Return a model object with cursor document. (used in foreach).
first ( ) : mixed Returns the first element of the cursor.
key ( ) : integer Iterator key method (used in foreach).
limit ( integer $amount ) : EmbeddedCursor Limits the number of results returned.
next ( ) : void Iterator next method (used in foreach).
rewind ( ) : void Iterator interface rewind (used in foreach).
skip ( integer $amount ) : EmbeddedCursor Skips a number of results.
sort ( array $fields ) : EmbeddedCursor Sorts the results by given fields.
toArray ( ) : array Return the raw cursor items.
valid ( ) : boolean Iterator valid method (used in foreach).

Защищенные методы

Метод Описание
getSchemaForEntity ( ) : Schema Retrieve a schema based on Entity Class.

Описание методов

__construct() публичный метод

public __construct ( string $entityClass, array $items )
$entityClass string Class of the objects that will be retrieved by the cursor.
$items array The items array.

all() публичный метод

Convert the cursor instance to an array of Items.
public all ( ) : array
Результат array

count() публичный метод

Counts the number of results for this cursor.
public count ( ) : integer
Результат integer The number of documents returned by this cursor's query.

current() публичный метод

Iterator interface current. Return a model object with cursor document. (used in foreach).
public current ( ) : mixed
Результат mixed

first() публичный метод

Returns the first element of the cursor.
public first ( ) : mixed
Результат mixed

getSchemaForEntity() защищенный метод

Retrieve a schema based on Entity Class.
protected getSchemaForEntity ( ) : Schema
Результат Mongolid\Schema\Schema

key() публичный метод

Iterator key method (used in foreach).
public key ( ) : integer
Результат integer

limit() публичный метод

Limits the number of results returned.
public limit ( integer $amount ) : EmbeddedCursor
$amount integer The number of results to return.
Результат EmbeddedCursor Returns this cursor.

next() публичный метод

Iterator next method (used in foreach).
public next ( ) : void
Результат void

rewind() публичный метод

Iterator interface rewind (used in foreach).
public rewind ( ) : void
Результат void

skip() публичный метод

Skips a number of results.
public skip ( integer $amount ) : EmbeddedCursor
$amount integer The number of results to skip.
Результат EmbeddedCursor Returns this cursor.

sort() публичный метод

Sorts the results by given fields.
public sort ( array $fields ) : EmbeddedCursor
$fields array An array of fields by which to sort. Each element in the array has as key the field name, and as value either 1 for ascending sort, or -1 for descending sort.
Результат EmbeddedCursor Returns this cursor.

toArray() публичный метод

Return the raw cursor items.
public toArray ( ) : array
Результат array

valid() публичный метод

Iterator valid method (used in foreach).
public valid ( ) : boolean
Результат boolean

Описание свойств

$entityClass публичное свойство

Entity class that will be returned while iterating.
public string $entityClass
Результат string

$items защищенное свойство

The actual array of embedded documents.
protected array $items
Результат array