PHP 클래스 JamesMoss\Flywheel\Result

A collection of Documents returned from a Query. This class acts like an array but also has some helper methods for manipulating the collection in useful ways.
상속: implements IteratorAggregate, implements ArrayAccess, implements Countable
파일 보기 프로젝트 열기: jamesmoss/flywheel 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$documents
$total

공개 메소드들

메소드 설명
__construct ( array $documents, integer $total ) Constructor
count ( ) : integer Returns the number of documents in this result
first ( ) : mixed Gets the first document from the result.
getIterator ( )
hash ( string $keyField, string $valueField ) : array Returns an assoiative array (a hash), where for each document the value of one property is the key, and another property is the value.
last ( ) : mixed Gets the last document from the results.
offsetExists ( $offset )
offsetGet ( $offset )
offsetSet ( $offset, $value )
offsetUnset ( $offset )
pick ( string $field ) : array Returns an array where each value is a single property from each document. If the property doesnt exist on the document then it won't be in the returned array.
total ( ) : integer Returns the total number of documents (if using limit in a query).
value ( $key ) : mixed Get the value specified by $key of the first object in the result.

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( array $documents, integer $total )
$documents array An array of Documents
$total integer If this result only represents a small slice of the total (when using limit), this parameter represents the total number of documents.

count() 공개 메소드

Returns the number of documents in this result
public count ( ) : integer
리턴 integer The number of documents

first() 공개 메소드

Gets the first document from the result.
public first ( ) : mixed
리턴 mixed The first document, or false if the result is empty.

getIterator() 공개 메소드

public getIterator ( )

hash() 공개 메소드

Returns an assoiative array (a hash), where for each document the value of one property is the key, and another property is the value.
public hash ( string $keyField, string $valueField ) : array
$keyField string The name of the property to use for the key.
$valueField string Name of the property to use for the value.
리턴 array An associative array.

last() 공개 메소드

Gets the last document from the results.
public last ( ) : mixed
리턴 mixed The last document, or false if the result is empty.

offsetExists() 공개 메소드

public offsetExists ( $offset )

offsetGet() 공개 메소드

public offsetGet ( $offset )

offsetSet() 공개 메소드

public offsetSet ( $offset, $value )

offsetUnset() 공개 메소드

public offsetUnset ( $offset )

pick() 공개 메소드

Returns an array where each value is a single property from each document. If the property doesnt exist on the document then it won't be in the returned array.
public pick ( string $field ) : array
$field string The name of the field to pick.
리턴 array The array of values, one from each document.

total() 공개 메소드

Useful for working out pagination.
public total ( ) : integer
리턴 integer The total number of documents

value() 공개 메소드

Get the value specified by $key of the first object in the result.
public value ( $key ) : mixed
리턴 mixed The value, or false if there are no documents or the key doesnt exist.

프로퍼티 상세

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

protected $documents

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

protected $total