PHP 클래스 Mongolid\Cursor\Cursor

By doing this we can, call '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, implements Serializabl\Serializable
파일 보기 프로젝트 열기: leroy-merlin-br/mongolid 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$entitySchema string Schema that describes the entity that will be retrieved when iterating through the cursor.

보호된 프로퍼티들

프로퍼티 타입 설명
$assembler Mongolid\DataMapper\EntityAssembler Have the responsibility of assembling the data coming from the database into actual entities.
$collection MongoDB\Collection
$command string The command that is being called in the $collection.
$converter Mongolid\Serializer\Type\Converter Object responsible to convert domain objects to mongo objects and vice versa.
$cursor MongoDB\Driver\Cursor The MongoDB cursor used to interact with db.
$params array The parameters of the $command.
$position integer Iterator position (to be used with foreach).

공개 메소드들

메소드 설명
__construct ( Schema $entitySchema, MongoDB\Collection $collection, string $command, array $params )
all ( ) : array Convert the cursor instance to an array of Objects.
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).
disableTimeout ( boolean $flag = true ) : Cursor Disable idle timeout of 10 minutes from MongoDB cursor.
first ( ) : mixed Returns the first element of the cursor.
fresh ( ) : void Refresh the cursor in order to be able to perform a rewind and iterate through it again. A new request to the database will be made in the next iteration.
key ( ) : integer Iterator key method (used in foreach).
limit ( integer $amount ) : Cursor Limits the number of results returned.
next ( ) : void Iterator next method (used in foreach).
rewind ( ) : void Iterator interface rewind (used in foreach).
serialize ( ) : string Serializes this object storing the collection name instead of the actual MongoDb\Collection (which is unserializable).
skip ( integer $amount ) : Cursor Skips a number of results.
sort ( array $fields ) : Cursor Sorts the results by given fields.
toArray ( ) : array Convert the cursor instance to a full associative array.
unserialize ( mixed $serialized ) : void Unserializes this object. Re-creating the database connection.
valid ( ) : boolean Iterator valid method (used in foreach).

보호된 메소드들

메소드 설명
getAssembler ( ) : EntityAssembler Retrieves an EntityAssembler instance.
getConverter ( ) : Converter Converter is responsible to convert domain objects to mongo objects and vice versa.
getCursor ( ) : Traversable Actually returns a Traversable object with the DriverCursor within.

메소드 상세

__construct() 공개 메소드

public __construct ( Schema $entitySchema, MongoDB\Collection $collection, string $command, array $params )
$entitySchema Mongolid\Schema\Schema Schema that describes the entity that will be retrieved from the database.
$collection MongoDB\Collection The raw collection object that will be used to retrieve the documents.
$command string The command that is being called in the $collection.
$params array The parameters of the $command.

all() 공개 메소드

Convert the cursor instance to an array of Objects.
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

disableTimeout() 공개 메소드

This method should be called before the cursor was started.
public disableTimeout ( boolean $flag = true ) : Cursor
$flag boolean Toggle timeout on or off.
리턴 Cursor Returns this cursor.

first() 공개 메소드

Returns the first element of the cursor.
public first ( ) : mixed
리턴 mixed

fresh() 공개 메소드

Refresh the cursor in order to be able to perform a rewind and iterate through it again. A new request to the database will be made in the next iteration.
public fresh ( ) : void
리턴 void

getAssembler() 보호된 메소드

Retrieves an EntityAssembler instance.
protected getAssembler ( ) : EntityAssembler
리턴 Mongolid\DataMapper\EntityAssembler

getConverter() 보호된 메소드

Converter is responsible to convert domain objects to mongo objects and vice versa.
protected getConverter ( ) : Converter
리턴 Mongolid\Serializer\Type\Converter

getCursor() 보호된 메소드

If it does not exists yet, create it using the $collection, $command and $params given.
protected getCursor ( ) : Traversable
리턴 Traversable

key() 공개 메소드

Iterator key method (used in foreach).
public key ( ) : integer
리턴 integer

limit() 공개 메소드

Limits the number of results returned.
public limit ( integer $amount ) : Cursor
$amount integer The number of results to return.
리턴 Cursor 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

serialize() 공개 메소드

Serializes this object storing the collection name instead of the actual MongoDb\Collection (which is unserializable).
public serialize ( ) : string
리턴 string Serialized object.

skip() 공개 메소드

Skips a number of results.
public skip ( integer $amount ) : Cursor
$amount integer The number of results to skip.
리턴 Cursor Returns this cursor.

sort() 공개 메소드

Sorts the results by given fields.
public sort ( array $fields ) : Cursor
$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.
리턴 Cursor Returns this cursor.

toArray() 공개 메소드

Convert the cursor instance to a full associative array.
public toArray ( ) : array
리턴 array

unserialize() 공개 메소드

Unserializes this object. Re-creating the database connection.
public unserialize ( mixed $serialized ) : void
$serialized mixed Serialized cursor.
리턴 void

valid() 공개 메소드

Iterator valid method (used in foreach).
public valid ( ) : boolean
리턴 boolean

프로퍼티 상세

$assembler 보호되어 있는 프로퍼티

Have the responsibility of assembling the data coming from the database into actual entities.
protected EntityAssembler,Mongolid\DataMapper $assembler
리턴 Mongolid\DataMapper\EntityAssembler

$collection 보호되어 있는 프로퍼티

protected Collection,MongoDB $collection
리턴 MongoDB\Collection

$command 보호되어 있는 프로퍼티

The command that is being called in the $collection.
protected string $command
리턴 string

$converter 보호되어 있는 프로퍼티

Object responsible to convert domain objects to mongo objects and vice versa.
protected Converter,Mongolid\Serializer\Type $converter
리턴 Mongolid\Serializer\Type\Converter

$cursor 보호되어 있는 프로퍼티

The MongoDB cursor used to interact with db.
protected Cursor,MongoDB\Driver $cursor
리턴 MongoDB\Driver\Cursor

$entitySchema 공개적으로 프로퍼티

Schema that describes the entity that will be retrieved when iterating through the cursor.
public string $entitySchema
리턴 string

$params 보호되어 있는 프로퍼티

The parameters of the $command.
protected array $params
리턴 array

$position 보호되어 있는 프로퍼티

Iterator position (to be used with foreach).
protected int $position
리턴 integer