QueryInterface
A persistence query interface
Table of Contents
Constants
- OPERATOR_CONTAINS = 8
- The 'contains' comparison operator for collections.
- OPERATOR_EQUAL_TO = 1
- The '=' comparison operator.
- OPERATOR_EQUAL_TO_NULL = 101
- For NULL we have to use 'IS' instead of '='
- OPERATOR_GREATER_THAN = 5
- The '>' comparison operator.
- OPERATOR_GREATER_THAN_OR_EQUAL_TO = 6
- The '>=' comparison operator.
- OPERATOR_IN = 9
- The 'in' comparison operator.
- OPERATOR_IS_EMPTY = 11
- The 'is empty' comparison operator for collections.
- OPERATOR_IS_NULL = 10
- The 'is NULL' comparison operator.
- OPERATOR_LESS_THAN = 3
- The '<' comparison operator.
- OPERATOR_LESS_THAN_OR_EQUAL_TO = 4
- The '<=' comparison operator.
- OPERATOR_LIKE = 7
- The 'like' comparison operator.
- OPERATOR_NOT_EQUAL_TO = 2
- The '!=' comparison operator.
- OPERATOR_NOT_EQUAL_TO_NULL = 202
- For NULL we have to use 'IS NOT' instead of '!='
- ORDER_ASCENDING = 'ASC'
- Constants representing the direction when ordering result sets.
- ORDER_DESCENDING = 'DESC'
Methods
- contains() : ComparisonInterface
- Returns a "contains" criterion used for matching objects against a query.
- count() : int
- Returns the query result count.
- equals() : ComparisonInterface
- Returns an equals criterion used for matching objects against a query.
- execute() : QueryResultInterface|array<string|int, object>
- Executes the query and returns the result.
- getConstraint() : ConstraintInterface|null
- Gets the constraint for this query.
- getLimit() : int
- Returns the maximum size of the result set to limit.
- getOffset() : int
- Returns the start offset of the result set.
- getOrderings() : array<string, string>
- Gets the property names to order the result by, like this: array( 'foo' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING )
- getQuerySettings() : QuerySettingsInterface
- Returns the Query Settings.
- getSource() : SourceInterface
- Gets the node-tuple source for this query.
- getStatement() : Statement
- Returns the statement of this query.
- getType() : string
- Returns the type this query cares for.
- greaterThan() : ComparisonInterface
- Returns a greater than criterion used for matching objects against a query
- greaterThanOrEqual() : ComparisonInterface
- Returns a greater than or equal criterion used for matching objects against a query
- in() : ComparisonInterface
- Returns an "in" criterion used for matching objects against a query. It matches if the property's value is contained in the multivalued operand.
- lessThan() : ComparisonInterface
- Returns a less than criterion used for matching objects against a query
- lessThanOrEqual() : ComparisonInterface
- Returns a less or equal than criterion used for matching objects against a query
- like() : ComparisonInterface
- Returns a like criterion used for matching objects against a query.
- logicalAnd() : AndInterface
- Performs a logical conjunction of the two given constraints. The method takes one or more constraints and concatenates them with a boolean AND.
- logicalNot() : NotInterface
- Performs a logical negation of the given constraint
- logicalOr() : OrInterface
- Performs a logical disjunction of the two given constraints. The method takes one or more constraints and concatenates them with a boolean OR.
- matching() : QueryInterface
- The constraint used to limit the result set. Returns $this to allow for chaining (fluid interface).
- setLimit() : QueryInterface
- Sets the maximum size of the result set to limit. Returns $this to allow for chaining (fluid interface).
- setOffset() : QueryInterface
- Sets the start offset of the result set to offset. Returns $this to allow for chaining (fluid interface).
- setOrderings() : QueryInterface
- Sets the property names to order the result by. Expected like this: array( 'foo' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING )
- setQuerySettings() : mixed
- Sets the Query Settings. These Query settings must match the settings expected by the specific Storage Backend.
- setSource() : mixed
- Sets the source to fetch the result from
Constants
OPERATOR_CONTAINS
The 'contains' comparison operator for collections.
public
mixed
OPERATOR_CONTAINS
= 8
OPERATOR_EQUAL_TO
The '=' comparison operator.
public
mixed
OPERATOR_EQUAL_TO
= 1
OPERATOR_EQUAL_TO_NULL
For NULL we have to use 'IS' instead of '='
public
mixed
OPERATOR_EQUAL_TO_NULL
= 101
OPERATOR_GREATER_THAN
The '>' comparison operator.
public
mixed
OPERATOR_GREATER_THAN
= 5
OPERATOR_GREATER_THAN_OR_EQUAL_TO
The '>=' comparison operator.
public
mixed
OPERATOR_GREATER_THAN_OR_EQUAL_TO
= 6
OPERATOR_IN
The 'in' comparison operator.
public
mixed
OPERATOR_IN
= 9
OPERATOR_IS_EMPTY
The 'is empty' comparison operator for collections.
public
mixed
OPERATOR_IS_EMPTY
= 11
OPERATOR_IS_NULL
The 'is NULL' comparison operator.
public
mixed
OPERATOR_IS_NULL
= 10
OPERATOR_LESS_THAN
The '<' comparison operator.
public
mixed
OPERATOR_LESS_THAN
= 3
OPERATOR_LESS_THAN_OR_EQUAL_TO
The '<=' comparison operator.
public
mixed
OPERATOR_LESS_THAN_OR_EQUAL_TO
= 4
OPERATOR_LIKE
The 'like' comparison operator.
public
mixed
OPERATOR_LIKE
= 7
OPERATOR_NOT_EQUAL_TO
The '!=' comparison operator.
public
mixed
OPERATOR_NOT_EQUAL_TO
= 2
OPERATOR_NOT_EQUAL_TO_NULL
For NULL we have to use 'IS NOT' instead of '!='
public
mixed
OPERATOR_NOT_EQUAL_TO_NULL
= 202
ORDER_ASCENDING
Constants representing the direction when ordering result sets.
public
mixed
ORDER_ASCENDING
= 'ASC'
ORDER_DESCENDING
public
mixed
ORDER_DESCENDING
= 'DESC'
Methods
contains()
Returns a "contains" criterion used for matching objects against a query.
public
contains(string $propertyName, mixed $operand) : ComparisonInterface
It matches if the multivalued property contains the given operand.
If NULL is given as $operand, there will never be a match!
Parameters
- $propertyName : string
-
The name of the multivalued property to compare against
- $operand : mixed
-
The value to compare with
Tags
Return values
ComparisonInterfacecount()
Returns the query result count.
public
count() : int
Return values
int —The query result count
equals()
Returns an equals criterion used for matching objects against a query.
public
equals(string $propertyName, mixed $operand[, bool $caseSensitive = true ]) : ComparisonInterface
It matches if the $operand equals the value of the property named $propertyName. If $operand is NULL a strict check for NULL is done. For strings the comparison can be done with or without case-sensitivity.
Parameters
- $propertyName : string
-
The name of the property to compare against
- $operand : mixed
-
The value to compare with
- $caseSensitive : bool = true
-
Whether the equality test should be done case-sensitive for strings
Return values
ComparisonInterfaceexecute()
Executes the query and returns the result.
public
execute([bool $returnRawQueryResult = false ]) : QueryResultInterface|array<string|int, object>
Parameters
- $returnRawQueryResult : bool = false
-
avoids the object mapping by the persistence
Return values
QueryResultInterface|array<string|int, object> —The query result object or an array if $returnRawQueryResult is TRUE
getConstraint()
Gets the constraint for this query.
public
getConstraint() : ConstraintInterface|null
Return values
ConstraintInterface|null —the constraint, or null if none
getLimit()
Returns the maximum size of the result set to limit.
public
getLimit() : int
Return values
intgetOffset()
Returns the start offset of the result set.
public
getOffset() : int
Return values
intgetOrderings()
Gets the property names to order the result by, like this: array( 'foo' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING )
public
getOrderings() : array<string, string>
Return values
array<string, string>getQuerySettings()
Returns the Query Settings.
public
getQuerySettings() : QuerySettingsInterface
Tags
Return values
QuerySettingsInterface —$querySettings The Query Settings
getSource()
Gets the node-tuple source for this query.
public
getSource() : SourceInterface
Return values
SourceInterface —the node-tuple source; non-NULL
getStatement()
Returns the statement of this query.
public
getStatement() : Statement
Return values
StatementgetType()
Returns the type this query cares for.
public
getType() : string
Return values
stringgreaterThan()
Returns a greater than criterion used for matching objects against a query
public
greaterThan(string $propertyName, mixed $operand) : ComparisonInterface
Parameters
- $propertyName : string
-
The name of the property to compare against
- $operand : mixed
-
The value to compare with
Tags
Return values
ComparisonInterfacegreaterThanOrEqual()
Returns a greater than or equal criterion used for matching objects against a query
public
greaterThanOrEqual(string $propertyName, mixed $operand) : ComparisonInterface
Parameters
- $propertyName : string
-
The name of the property to compare against
- $operand : mixed
-
The value to compare with
Tags
Return values
ComparisonInterfacein()
Returns an "in" criterion used for matching objects against a query. It matches if the property's value is contained in the multivalued operand.
public
in(string $propertyName, mixed $operand) : ComparisonInterface
Parameters
- $propertyName : string
-
The name of the property to compare against
- $operand : mixed
-
The value to compare with, multivalued
Tags
Return values
ComparisonInterfacelessThan()
Returns a less than criterion used for matching objects against a query
public
lessThan(string $propertyName, mixed $operand) : ComparisonInterface
Parameters
- $propertyName : string
-
The name of the property to compare against
- $operand : mixed
-
The value to compare with
Tags
Return values
ComparisonInterfacelessThanOrEqual()
Returns a less or equal than criterion used for matching objects against a query
public
lessThanOrEqual(string $propertyName, mixed $operand) : ComparisonInterface
Parameters
- $propertyName : string
-
The name of the property to compare against
- $operand : mixed
-
The value to compare with
Tags
Return values
ComparisonInterfacelike()
Returns a like criterion used for matching objects against a query.
public
like(string $propertyName, string $operand) : ComparisonInterface
Matches if the property named $propertyName is like the $operand, using standard SQL wildcards.
Parameters
- $propertyName : string
-
The name of the property to compare against
- $operand : string
-
The value to compare with
Tags
Return values
ComparisonInterfacelogicalAnd()
Performs a logical conjunction of the two given constraints. The method takes one or more constraints and concatenates them with a boolean AND.
public
logicalAnd(ConstraintInterface|array<string|int, ConstraintInterface> $constraint1) : AndInterface
It also accepts a single array of constraints to be concatenated.
Parameters
- $constraint1 : ConstraintInterface|array<string|int, ConstraintInterface>
-
The first of multiple constraints or an array of constraints.
Return values
AndInterfacelogicalNot()
Performs a logical negation of the given constraint
public
logicalNot(ConstraintInterface $constraint) : NotInterface
Parameters
- $constraint : ConstraintInterface
-
Constraint to negate
Return values
NotInterfacelogicalOr()
Performs a logical disjunction of the two given constraints. The method takes one or more constraints and concatenates them with a boolean OR.
public
logicalOr(ConstraintInterface|array<string|int, ConstraintInterface> $constraint1) : OrInterface
It also accepts a single array of constraints to be concatenated.
Parameters
- $constraint1 : ConstraintInterface|array<string|int, ConstraintInterface>
-
The first of multiple constraints or an array of constraints.
Return values
OrInterfacematching()
The constraint used to limit the result set. Returns $this to allow for chaining (fluid interface).
public
matching(ConstraintInterface $constraint) : QueryInterface
Parameters
- $constraint : ConstraintInterface
-
Some constraint, depending on the backend
Return values
QueryInterfacesetLimit()
Sets the maximum size of the result set to limit. Returns $this to allow for chaining (fluid interface).
public
setLimit(int $limit) : QueryInterface
Parameters
- $limit : int
Return values
QueryInterfacesetOffset()
Sets the start offset of the result set to offset. Returns $this to allow for chaining (fluid interface).
public
setOffset(int $offset) : QueryInterface
Parameters
- $offset : int
Return values
QueryInterfacesetOrderings()
Sets the property names to order the result by. Expected like this: array( 'foo' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING )
public
setOrderings(array<string, string> $orderings) : QueryInterface
Parameters
- $orderings : array<string, string>
-
The property names to order by
Return values
QueryInterfacesetQuerySettings()
Sets the Query Settings. These Query settings must match the settings expected by the specific Storage Backend.
public
setQuerySettings(QuerySettingsInterface $querySettings) : mixed
Parameters
- $querySettings : QuerySettingsInterface
-
The Query Settings
Tags
setSource()
Sets the source to fetch the result from
public
setSource(SourceInterface $source) : mixed
Parameters
- $source : SourceInterface