QueryInterface
interface QueryInterface (View source)
A persistence query interface.
The main point when implementing this is to make sure that methods with a return type of "object" return something that can be fed to matching() and all constraint-generating methods (like logicalAnd(), equals(), like(), ...).
This allows for code like $query->matching($query->equals('foo', 'bar'))->setLimit(10)->execute();
Constants
OPERATOR_EQUAL_TO |
The '=' comparison operator. |
OPERATOR_NOT_EQUAL_TO |
The '!=' comparison operator. |
OPERATOR_LESS_THAN |
The '<' comparison operator. |
OPERATOR_LESS_THAN_OR_EQUAL_TO |
The '<=' comparison operator. |
OPERATOR_GREATER_THAN |
The '>' comparison operator. |
OPERATOR_GREATER_THAN_OR_EQUAL_TO |
The '>=' comparison operator. |
OPERATOR_LIKE |
The 'like' comparison operator. |
OPERATOR_CONTAINS |
The 'contains' comparison operator for collections. |
OPERATOR_IN |
The 'in' comparison operator. |
OPERATOR_IS_NULL |
The 'is NULL' comparison operator. |
OPERATOR_IS_EMPTY |
The 'is empty' comparison operator for collections. |
ORDER_ASCENDING |
Constants representing the direction when ordering result sets. |
ORDER_DESCENDING |
|
Methods
Returns the type this query cares for.
Executes the query and returns the result.
Returns the query result count.
Sets the property names to order the result by. Expected like this: array( 'foo' => \Neos\Flow\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \Neos\Flow\Persistence\QueryInterface::ORDER_DESCENDING )
Gets the property names to order the result by, like this: array( 'foo' => \Neos\Flow\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \Neos\Flow\Persistence\QueryInterface::ORDER_DESCENDING )
Sets the maximum size of the result set to limit. Returns $this to allow for chaining (fluid interface).
Returns the maximum size of the result set to limit.
Sets the DISTINCT flag for this query.
Returns the DISTINCT flag for this query.
Sets the start offset of the result set to offset. Returns $this to allow for chaining (fluid interface).
Returns the start offset of the result set.
The constraint used to limit the result set. Returns $this to allow for chaining (fluid interface).
Gets the constraint for this query.
Performs a logical conjunction of the two given constraints. The method takes one or more constraints and concatenates them with a boolean AND.
Performs a logical disjunction of the two given constraints. The method takes one or more constraints and concatenates them with a boolean OR.
Performs a logical negation of the given constraint
Returns an equals criterion used for matching objects against a query.
Returns a like criterion used for matching objects against a query.
Returns a "contains" criterion used for matching objects against a query.
Returns an "isEmpty" criterion used for matching objects against a query.
Returns an "in" criterion used for matching objects against a query. It matches if the property's value is contained in the multivalued operand.
Returns a less than criterion used for matching objects against a query
Returns a less or equal than criterion used for matching objects against a query
Returns a greater than criterion used for matching objects against a query
Returns a greater than or equal criterion used for matching objects against a query
Details
string
getType()
Returns the type this query cares for.
QueryResultInterface
execute(bool $cacheResult = false)
Executes the query and returns the result.
int
count()
Returns the query result count.
QueryInterface
setOrderings(array $orderings)
Sets the property names to order the result by. Expected like this: array( 'foo' => \Neos\Flow\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \Neos\Flow\Persistence\QueryInterface::ORDER_DESCENDING )
array
getOrderings()
Gets the property names to order the result by, like this: array( 'foo' => \Neos\Flow\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \Neos\Flow\Persistence\QueryInterface::ORDER_DESCENDING )
QueryInterface
setLimit(int|null $limit)
Sets the maximum size of the result set to limit. Returns $this to allow for chaining (fluid interface).
int|null
getLimit()
Returns the maximum size of the result set to limit.
QueryInterface
setDistinct(bool $distinct = true)
Sets the DISTINCT flag for this query.
bool
isDistinct()
Returns the DISTINCT flag for this query.
QueryInterface
setOffset(int|null $offset)
Sets the start offset of the result set to offset. Returns $this to allow for chaining (fluid interface).
int|null
getOffset()
Returns the start offset of the result set.
QueryInterface
matching(object $constraint)
The constraint used to limit the result set. Returns $this to allow for chaining (fluid interface).
mixed
getConstraint()
Gets the constraint for this query.
object
logicalAnd(mixed $constraint1, mixed ...$constraints)
Performs a logical conjunction of the two given constraints. The method takes one or more constraints and concatenates them with a boolean AND.
It also accepts a single array of constraints to be concatenated.
object
logicalOr(mixed $constraint1, mixed ...$constraints)
Performs a logical disjunction of the two given constraints. The method takes one or more constraints and concatenates them with a boolean OR.
It also accepts a single array of constraints to be concatenated.
object
logicalNot(object $constraint)
Performs a logical negation of the given constraint
object
equals(string $propertyName, mixed $operand, bool $caseSensitive = true)
Returns an equals criterion used for matching objects against a query.
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.
object
like(string $propertyName, string $operand, bool $caseSensitive = true)
Returns a like criterion used for matching objects against a query.
Matches if the property named $propertyName is like the $operand, using standard SQL wildcards.
mixed
contains(string $propertyName, mixed $operand)
Returns a "contains" criterion used for matching objects against a query.
It matches if the multivalued property contains the given operand.
If NULL is given as $operand, there will never be a match!
mixed
isEmpty(string $propertyName)
Returns an "isEmpty" criterion used for matching objects against a query.
It matches if the multivalued property contains no values or is NULL.
object
in(string $propertyName, mixed $operand)
Returns an "in" criterion used for matching objects against a query. It matches if the property's value is contained in the multivalued operand.
object
lessThan(string $propertyName, mixed $operand)
Returns a less than criterion used for matching objects against a query
object
lessThanOrEqual(string $propertyName, mixed $operand)
Returns a less or equal than criterion used for matching objects against a query
object
greaterThan(string $propertyName, mixed $operand)
Returns a greater than criterion used for matching objects against a query
object
greaterThanOrEqual(string $propertyName, mixed $operand)
Returns a greater than or equal criterion used for matching objects against a query