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
파일 보기 프로젝트 열기: leroy-merlin-br/mongolid

공개 프로퍼티들

프로퍼티 타입 설명
$entityClass string Entity class that will be returned while iterating.

보호된 프로퍼티들

프로퍼티 타입 설명
$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