PHP Class JamesMoss\Flywheel\Query

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

Protected Properties

Свойство Type Description
$limit
$orderBy
$predicate
$repo

Méthodes publiques

Méthode Description
__construct ( Repository $repository ) Constructor
andWhere ( string | Closure $field, string $operator = null, string $value = null ) : Query Adds a boolean AND predicate for this query,
execute ( ) : Result Runs the query.
limit ( integer $count, integer $offset ) : Query Set a limit on the number of documents returned. An offset from 0 can also be specified.
orWhere ( string | Closure $field, string $operator = null, string $value = null ) : Query Adds a boolean OR predicate for this query,
orderBy ( mixed $fields ) : Query Sets the fields to order the results by. They should be in the the format 'fieldname ASC|DESC'. e.g 'dateAdded DESC'.
where ( $field, $operator = null, $value = null ) : Query

Method Details

__construct() public méthode

Constructor
public __construct ( Repository $repository )
$repository Repository The repo this query will run against.

andWhere() public méthode

Adds a boolean AND predicate for this query,
public andWhere ( string | Closure $field, string $operator = null, string $value = null ) : Query
$field string | Closure The name of the field to match or an anonymous function that will define sub predicates.
$operator string An operator from the allowed list.
$value string The value to compare against.
Résultat Query The same instance of this class.

execute() public méthode

Runs the query.
public execute ( ) : Result
Résultat Result The documents returned from this query.

limit() public méthode

Set a limit on the number of documents returned. An offset from 0 can also be specified.
public limit ( integer $count, integer $offset ) : Query
$count integer The number of documents to return.
$offset integer The offset from which to return.
Résultat Query The same instance of this class.

orWhere() public méthode

Adds a boolean OR predicate for this query,
public orWhere ( string | Closure $field, string $operator = null, string $value = null ) : Query
$field string | Closure The name of the field to match or an anonymous function that will define sub predicates.
$operator string An operator from the allowed list.
$value string The value to compare against.
Résultat Query The same instance of this class.

orderBy() public méthode

Sets the fields to order the results by. They should be in the the format 'fieldname ASC|DESC'. e.g 'dateAdded DESC'.
public orderBy ( mixed $fields ) : Query
$fields mixed An array comprising strings in the above format (or a single string)
Résultat Query The same instance of this class.

where() public méthode

See also: Query::andWhere
public where ( $field, $operator = null, $value = null ) : Query
Résultat Query The same instance of this class.

Property Details

$limit protected_oe property

protected $limit

$orderBy protected_oe property

protected $orderBy

$predicate protected_oe property

protected $predicate

$repo protected_oe property

protected $repo