PHP Class JamesMoss\Flywheel\QueryExecuter

Builds an executes a query whichs searches and sorts documents from a repository.
Show file Open project: jamesmoss/flywheel Class Usage Examples

Protected Properties

Property Type Description
$limit
$orderBy
$predicate
$repo

Public Methods

Method Description
__construct ( Repository $repo, Predicate $pred, array $limit, array $orderBy ) Constructor
getFieldValue ( $doc, $field, &$found = false )
matchDocument ( $doc, $field, $operator, $value )
run ( ) : Result Runs the query.

Protected Methods

Method Description
filter ( $documents, $predicates )
sort ( array $array, array $args ) : array Sorts an array of documents by multiple fields if needed.

Method Details

__construct() public method

Constructor
public __construct ( Repository $repo, Predicate $pred, array $limit, array $orderBy )
$repo Repository The repo to execute against
$pred Predicate The predicate to use.
$limit array The count and offset.
$orderBy array An array of field names to order by

filter() protected method

protected filter ( $documents, $predicates )

getFieldValue() public method

public getFieldValue ( $doc, $field, &$found = false )

matchDocument() public method

public matchDocument ( $doc, $field, $operator, $value )

run() public method

Runs the query.
public run ( ) : Result
return Result The documents returned from this query.

sort() protected method

Sorts an array of documents by multiple fields if needed.
protected sort ( array $array, array $args ) : array
$array array An array of Documents.
$args array The fields to sort by.
return array The sorted array of documents.

Property Details

$limit protected property

protected $limit

$orderBy protected property

protected $orderBy

$predicate protected property

protected $predicate

$repo protected property

protected $repo