Query implements QueryInterface
The Query class used to run queries against the database
Tags
Table of Contents
Interfaces
- QueryInterface
- A persistence query interface
Constants
- CHARSET = 'utf-8'
- Charset of strings in QOM
- JCR_JOIN_TYPE_INNER = '{http://www.jcp.org/jcr/1.0}joinTypeInner'
- An inner join.
- JCR_JOIN_TYPE_LEFT_OUTER = '{http://www.jcp.org/jcr/1.0}joinTypeLeftOuter'
- A left-outer join.
- JCR_JOIN_TYPE_RIGHT_OUTER = '{http://www.jcp.org/jcr/1.0}joinTypeRightOuter'
- A right-outer join.
Properties
- $constraint : ConstraintInterface
- $container : ContainerInterface
- $dataMapFactory : DataMapFactory
- $limit : int|null
- $offset : int
- $orderings : array<string, string>
- $parentQuery : QueryInterface|null
- $persistenceManager : PersistenceManagerInterface
- $qomFactory : QueryObjectModelFactory
- $querySettings : QuerySettingsInterface
- The query settings.
- $source : SourceInterface
- $statement : Statement
- $type : string
Methods
- __construct() : mixed
- __sleep() : array<string|int, mixed>
- __wakeup() : mixed
- between() : AndInterface
- Returns a greater than or equal criterion used for matching objects against a query
- 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<int, array<string, mixed>>
- Executes the query against the database and returns the result
- getConstraint() : ConstraintInterface|null
- Gets the constraint for this query.
- getLimit() : int|null
- Returns the maximum size of the result set to limit.
- getOffset() : int
- Returns the start offset of the result set.
- getOrderings() : array<string, string>
- Returns 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 )
- getParentQuery() : QueryInterface|null
- 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 multiple given constraints. The method takes an arbitrary number of 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 multiple given constraints. The method takes an arbitrary number of 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 ) where 'foo' and 'bar' are property names.
- setParentQuery() : void
- 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
- setType() : void
- Set the type this query cares for.
- statement() : QueryInterface
- Sets the statement of this query. If you use this, you will lose the abstraction from a concrete storage backend (database).
- unsetLimit() : QueryInterface
- Resets a previously set maximum size of the result set. Returns $this to allow for chaining (fluid interface)
- getSelectorName() : string
- Returns the selector's name or an empty string, if the source is not a selector
Constants
CHARSET
Charset of strings in QOM
public
mixed
CHARSET
= 'utf-8'
JCR_JOIN_TYPE_INNER
An inner join.
public
mixed
JCR_JOIN_TYPE_INNER
= '{http://www.jcp.org/jcr/1.0}joinTypeInner'
JCR_JOIN_TYPE_LEFT_OUTER
A left-outer join.
public
mixed
JCR_JOIN_TYPE_LEFT_OUTER
= '{http://www.jcp.org/jcr/1.0}joinTypeLeftOuter'
JCR_JOIN_TYPE_RIGHT_OUTER
A right-outer join.
public
mixed
JCR_JOIN_TYPE_RIGHT_OUTER
= '{http://www.jcp.org/jcr/1.0}joinTypeRightOuter'
Properties
$constraint
protected
ConstraintInterface
$constraint
$container
protected
ContainerInterface
$container
$dataMapFactory
protected
DataMapFactory
$dataMapFactory
$limit
protected
int|null
$limit
$offset
protected
int
$offset
$orderings
protected
array<string, string>
$orderings
= []
$parentQuery
protected
QueryInterface|null
$parentQuery
$persistenceManager
protected
PersistenceManagerInterface
$persistenceManager
$qomFactory
protected
QueryObjectModelFactory
$qomFactory
$querySettings
The query settings.
protected
QuerySettingsInterface
$querySettings
$source
protected
SourceInterface
$source
$statement
protected
Statement
$statement
$type
protected
string
$type
Tags
Methods
__construct()
public
__construct(DataMapFactory $dataMapFactory, PersistenceManagerInterface $persistenceManager, QueryObjectModelFactory $qomFactory, ContainerInterface $container) : mixed
Parameters
- $dataMapFactory : DataMapFactory
- $persistenceManager : PersistenceManagerInterface
- $qomFactory : QueryObjectModelFactory
- $container : ContainerInterface
__sleep()
public
__sleep() : array<string|int, mixed>
only to be used within Extbase, not part of TYPO3 Core API.
Return values
array<string|int, mixed>__wakeup()
public
__wakeup() : mixed
only to be used within Extbase, not part of TYPO3 Core API.
between()
Returns a greater than or equal criterion used for matching objects against a query
public
between(string $propertyName, mixed $operandLower, mixed $operandUpper) : AndInterface
Parameters
- $propertyName : string
-
The name of the property to compare against
- $operandLower : mixed
-
The value of the lower boundary to compare against
- $operandUpper : mixed
-
The value of the upper boundary to compare against
Return values
AndInterfacecontains()
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.
Parameters
- $propertyName : string
-
The name of the (multivalued) property to compare against
- $operand : mixed
-
The value to compare with
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
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
Return values
ComparisonInterfaceexecute()
Executes the query against the database and returns the result
public
execute([bool $returnRawQueryResult = false ]) : QueryResultInterface|array<int, array<string, mixed>>
Parameters
- $returnRawQueryResult : bool = false
-
avoids the object mapping by the persistence
Tags
Return values
QueryResultInterface|array<int, array<string, mixed>> —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|null
Return values
int|nullgetOffset()
Returns the start offset of the result set.
public
getOffset() : int
Return values
intgetOrderings()
Returns 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>getParentQuery()
public
getParentQuery() : QueryInterface|null
Return values
QueryInterface|nullgetQuerySettings()
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
Tags
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
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
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
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
Return values
ComparisonInterfacelike()
Returns a like criterion used for matching objects against a query
public
like(string $propertyName, mixed $operand) : ComparisonInterface
Parameters
- $propertyName : string
-
The name of the property to compare against
- $operand : mixed
-
The value to compare with
Return values
ComparisonInterfacelogicalAnd()
Performs a logical conjunction of multiple given constraints. The method takes an arbitrary number of constraints and concatenates them with a boolean AND.
public
logicalAnd(ConstraintInterface ...$constraints) : AndInterface
Parameters
- $constraints : ConstraintInterface
Return values
AndInterfacelogicalNot()
Performs a logical negation of the given constraint
public
logicalNot(ConstraintInterface $constraint) : NotInterface
Parameters
- $constraint : ConstraintInterface
-
Constraint to negate
Tags
Return values
NotInterfacelogicalOr()
Performs a logical disjunction of multiple given constraints. The method takes an arbitrary number of constraints and concatenates them with a boolean OR.
public
logicalOr(ConstraintInterface ...$constraints) : OrInterface
Parameters
- $constraints : ConstraintInterface
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
Tags
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
Tags
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
Tags
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 ) where 'foo' and 'bar' are property names.
public
setOrderings(array<string|int, mixed> $orderings) : QueryInterface
Parameters
- $orderings : array<string|int, mixed>
-
The property names to order by
Tags
Return values
QueryInterfacesetParentQuery()
public
setParentQuery(QueryInterface|null $parentQuery) : void
Parameters
- $parentQuery : QueryInterface|null
setQuerySettings()
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
setSource()
Sets the source to fetch the result from
public
setSource(SourceInterface $source) : mixed
Parameters
- $source : SourceInterface
setType()
Set the type this query cares for.
public
setType(string $type) : void
Parameters
- $type : string
Tags
statement()
Sets the statement of this query. If you use this, you will lose the abstraction from a concrete storage backend (database).
public
statement(string|QueryBuilder|Statement $statement[, array<string|int, mixed> $parameters = [] ]) : QueryInterface
Parameters
- $statement : string|QueryBuilder|Statement
-
The statement
- $parameters : array<string|int, mixed> = []
-
An array of parameters. These will be bound to placeholders '?' in the $statement.
Return values
QueryInterfaceunsetLimit()
Resets a previously set maximum size of the result set. Returns $this to allow for chaining (fluid interface)
public
unsetLimit() : QueryInterface
Return values
QueryInterfacegetSelectorName()
Returns the selector's name or an empty string, if the source is not a selector
protected
getSelectorName() : string
Tags
Return values
string —The selector name