Api4EntitySetQuery
extends Api4Query
in package
Constructs queries for set operations (UNION, etc).
Table of Contents
Constants
- MAIN_TABLE_ALIAS = 'a'
- UNLIMITED = '18446744073709551615'
Properties
- $apiFieldSpec : array<string|int, array<string|int, mixed>>
- $selectAliases : array<string|int, mixed>
- $api : AbstractQueryAction
- $entityValues : array<string|int, mixed>
- $query : CRM_Utils_SQL_Select
- $subqueries : mixed
Methods
- __construct() : mixed
- addSpecField() : mixed
- composeClause() : string
- Validate and transform a leaf clause array to SQL.
- debug() : mixed
- Add something to the api's debug output if debugging is enabled
- getApiParam() : mixed
- getCheckPermissions() : bool|string
- getField() : array<string|int, mixed>|null
- getGroupBy() : array<string|int, mixed>
- getHaving() : array<string|int, mixed>
- getJoin() : array<string|int, mixed>
- getLimit() : mixed
- getOffset() : mixed
- getOrderBy() : array<string|int, mixed>
- getQuery() : CRM_Utils_SQL_Select
- getResults() : array<string|int, mixed>
- getSelect() : array<string|int, mixed>
- getSql() : string
- Builds main final sql statement after initialization.
- getWhere() : array<string|int, mixed>
- run() : array<string|int, mixed>
- Why walk when you can
- treeWalkClauses() : string
- Recursively validate and transform a branch or leaf clause array to SQL.
- buildGroupBy() : mixed
- Add GROUP BY clause to query
- buildHavingClause() : mixed
- Add HAVING clause to query
- buildLimit() : mixed
- Add LIMIT to query
- buildOrderBy() : mixed
- Add ORDER BY to query
- buildSelectClause() : mixed
- Select * from all sets
- buildWhereClause() : mixed
- createSQLClause() : array<string|int, mixed>|string|null
- getExpression() : SqlExpression
- isAggregateQuery() : mixed
- renderExpr() : mixed|string
- Returns rendered expression or alias if it is already aliased in the SELECT clause.
- getSubquery() : Api4SelectQuery
Constants
MAIN_TABLE_ALIAS
public
mixed
MAIN_TABLE_ALIAS
= 'a'
UNLIMITED
public
mixed
UNLIMITED
= '18446744073709551615'
Properties
$apiFieldSpec
public
array<string|int, array<string|int, mixed>>
$apiFieldSpec
= []
$selectAliases
public
array<string|int, mixed>
$selectAliases
= []
[alias => expr][]
$api
protected
AbstractQueryAction
$api
$entityValues
protected
array<string|int, mixed>
$entityValues
= []
$query
protected
CRM_Utils_SQL_Select
$query
$subqueries
private
mixed
$subqueries
= []
Methods
__construct()
public
__construct(Get $api) : mixed
Parameters
- $api : Get
addSpecField()
public
addSpecField(string $path, array<string|int, mixed> $field) : mixed
Parameters
- $path : string
- $field : array<string|int, mixed>
composeClause()
Validate and transform a leaf clause array to SQL.
public
composeClause(array<string|int, mixed> $clause, string $type, int $depth) : string
Parameters
- $clause : array<string|int, mixed>
-
[$fieldName, $operator, $criteria, $isExpression]
- $type : string
-
WHERE|HAVING|ON
- $depth : int
Tags
Return values
string —SQL
debug()
Add something to the api's debug output if debugging is enabled
public
debug(mixed $key, mixed $item) : mixed
Parameters
- $key : mixed
- $item : mixed
getApiParam()
public
getApiParam(mixed $param) : mixed
Parameters
- $param : mixed
getCheckPermissions()
public
getCheckPermissions() : bool|string
Return values
bool|stringgetField()
public
getField(string $expr) : array<string|int, mixed>|null
Parameters
- $expr : string
Return values
array<string|int, mixed>|nullgetGroupBy()
public
getGroupBy() : array<string|int, mixed>
Return values
array<string|int, mixed>getHaving()
public
getHaving() : array<string|int, mixed>
Return values
array<string|int, mixed>getJoin()
public
getJoin() : array<string|int, mixed>
Return values
array<string|int, mixed>getLimit()
public
getLimit() : mixed
getOffset()
public
getOffset() : mixed
getOrderBy()
public
getOrderBy() : array<string|int, mixed>
Return values
array<string|int, mixed>getQuery()
public
getQuery() : CRM_Utils_SQL_Select
Return values
CRM_Utils_SQL_SelectgetResults()
public
getResults() : array<string|int, mixed>
Return values
array<string|int, mixed>getSelect()
public
getSelect() : array<string|int, mixed>
Return values
array<string|int, mixed>getSql()
Builds main final sql statement after initialization.
public
getSql() : string
Tags
Return values
stringgetWhere()
public
getWhere() : array<string|int, mixed>
Return values
array<string|int, mixed>run()
Why walk when you can
public
run() : array<string|int, mixed>
Return values
array<string|int, mixed>treeWalkClauses()
Recursively validate and transform a branch or leaf clause array to SQL.
public
treeWalkClauses(array<string|int, mixed> $clause, string $type[, int $depth = 0 ]) : string
Parameters
- $clause : array<string|int, mixed>
- $type : string
-
WHERE|HAVING|ON
- $depth : int = 0
Tags
Return values
string —SQL where clause
buildGroupBy()
Add GROUP BY clause to query
protected
buildGroupBy() : mixed
buildHavingClause()
Add HAVING clause to query
protected
buildHavingClause() : mixed
Every expression referenced must also be in the SELECT clause.
buildLimit()
Add LIMIT to query
protected
buildLimit() : mixed
Tags
buildOrderBy()
Add ORDER BY to query
protected
buildOrderBy() : mixed
buildSelectClause()
Select * from all sets
protected
buildSelectClause() : mixed
buildWhereClause()
protected
buildWhereClause() : mixed
createSQLClause()
protected
createSQLClause(string $fieldAlias, string $operator, mixed $value, array<string|int, mixed>|null $field, int $depth) : array<string|int, mixed>|string|null
Parameters
- $fieldAlias : string
- $operator : string
- $value : mixed
- $field : array<string|int, mixed>|null
- $depth : int
Tags
Return values
array<string|int, mixed>|string|nullgetExpression()
protected
getExpression(string $expr[, array<string|int, mixed> $allowedTypes = NULL ]) : SqlExpression
Parameters
- $expr : string
- $allowedTypes : array<string|int, mixed> = NULL
Tags
Return values
SqlExpressionisAggregateQuery()
protected
isAggregateQuery() : mixed
renderExpr()
Returns rendered expression or alias if it is already aliased in the SELECT clause.
protected
renderExpr(mixed $expr) : mixed|string
Parameters
- $expr : mixed
Return values
mixed|stringgetSubquery()
private
getSubquery([int $index = 0 ]) : Api4SelectQuery
Parameters
- $index : int = 0