PHP Класс Doctrine\MongoDB\Query\Query

С версии: 1.0
Автор: Jonathan H. Wage ([email protected])
Автор: Bulat Shakirzyanov ([email protected])
Наследование: implements Doctrine\MongoDB\IteratorAggregate
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$collection Doctrine\MongoDB\Collection The Collection instance.
$iterator Doctrine\MongoDB\Iterator
$options array Query options
$query array Query structure generated by the Builder class.

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

Метод Описание
__construct ( Doctrine\MongoDB\Collection $collection, array $query, array $options ) Constructor.
count ( boolean $foundOnly = false ) : integer Count the number of results for this query.
debug ( string $name = null ) : mixed Return an array of information about the query structure for debugging.
execute ( ) : mixed Execute the query and return its result.
getIterator ( ) : Doctrine\MongoDB\Iterator Execute the query and return its result, which must be an Iterator.
getQuery ( ) : array Return the query structure.
getSingleResult ( ) : array | object | null Execute the query and return the first result.
getType ( ) : integer Return the query type.
iterate ( ) : Doctrine\MongoDB\Iterator Alias of {@link Query::getIterator()}.
toArray ( ) : array Execute the query and return its results as an array.

Защищенные методы

Метод Описание
prepareCursor ( Doctrine\MongoDB\Cursor $cursor ) : Doctrine\MongoDB\CursorInterface Prepare the Cursor returned by {@link Query::execute()}.

Приватные методы

Метод Описание
getQueryOptions ( ) : array Returns an array containing the specified keys and their values from the query array, provided they exist and are not null.
renameQueryOptions ( array $options, array $rename ) : array Returns an array with its keys renamed based on the translation map.
withReadPreference ( Doctrine\MongoDB\Database | Doctrine\MongoDB\Collection $object, Closure $closure ) : mixed Executes a closure with a temporary read preference on a database or collection.

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

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

Constructor.
public __construct ( Doctrine\MongoDB\Collection $collection, array $query, array $options )
$collection Doctrine\MongoDB\Collection
$query array
$options array

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

If the query resulted in a Cursor, the $foundOnly parameter will ignore limit/skip values if false (the default). If the Query resulted in an EagerCursor or ArrayIterator, the $foundOnly parameter has no effect.
public count ( boolean $foundOnly = false ) : integer
$foundOnly boolean
Результат integer

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

The $name parameter may be used to return a specific key from the internal $query array property. If omitted, the entire array will be returned.
public debug ( string $name = null ) : mixed
$name string
Результат mixed

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

The return value will vary based on the query type. Commands with results (e.g. aggregate, inline mapReduce) may return an ArrayIterator. Other commands and operations may return a status array or a boolean, depending on the driver's write concern. Queries and some mapReduce commands will return a CursorInterface.
public execute ( ) : mixed
Результат mixed

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

If the query type is not expected to return an Iterator, BadMethodCallException will be thrown before executing the query. Otherwise, the query will be executed and UnexpectedValueException will be thrown if {@link Query::execute()} does not return an Iterator.
См. также: http://php.net/manual/en/iteratoraggregate.getiterator.php
public getIterator ( ) : Doctrine\MongoDB\Iterator
Результат Doctrine\MongoDB\Iterator

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

Return the query structure.
public getQuery ( ) : array
Результат array

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

Execute the query and return the first result.
См. также: IteratorAggregate::getSingleResult()
public getSingleResult ( ) : array | object | null
Результат array | object | null

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

Return the query type.
public getType ( ) : integer
Результат integer

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

Alias of {@link Query::getIterator()}.
Устаревший: 1.1 Use {@link Query::getIterator()}; will be removed for 2.0
public iterate ( ) : Doctrine\MongoDB\Iterator
Результат Doctrine\MongoDB\Iterator

prepareCursor() защищенный Метод

This method will apply cursor options present in the query structure array. The Cursor may also be wrapped with an EagerCursor.
protected prepareCursor ( Doctrine\MongoDB\Cursor $cursor ) : Doctrine\MongoDB\CursorInterface
$cursor Doctrine\MongoDB\Cursor
Результат Doctrine\MongoDB\CursorInterface

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

Execute the query and return its results as an array.
См. также: IteratorAggregate::toArray()
public toArray ( ) : array
Результат array

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

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

The Collection instance.
protected Collection,Doctrine\MongoDB $collection
Результат Doctrine\MongoDB\Collection

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

protected Iterator,Doctrine\MongoDB $iterator
Результат Doctrine\MongoDB\Iterator

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

Query options
protected array $options
Результат array

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

Query structure generated by the Builder class.
protected array $query
Результат array