PHP Класс JamesMoss\Flywheel\Query

Builds an executes a query whichs searches and sorts documents from a repository.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$limit
$orderBy
$predicate
$repo

Открытые методы

Метод Описание
__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

Описание методов

__construct() публичный Метод

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

andWhere() публичный Метод

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.
Результат Query The same instance of this class.

execute() публичный Метод

Runs the query.
public execute ( ) : Result
Результат Result The documents returned from this query.

limit() публичный Метод

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.
Результат Query The same instance of this class.

orWhere() публичный Метод

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.
Результат Query The same instance of this class.

orderBy() публичный Метод

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)
Результат Query The same instance of this class.

where() публичный Метод

См. также: Query::andWhere
public where ( $field, $operator = null, $value = null ) : Query
Результат Query The same instance of this class.

Описание свойств

$limit защищенное свойство

protected $limit

$orderBy защищенное свойство

protected $orderBy

$predicate защищенное свойство

protected $predicate

$repo защищенное свойство

protected $repo