Documentation

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][]

$entityValues

protected array<string|int, mixed> $entityValues = []

Methods

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
throws
CRM_Core_Exception
throws
Exception
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|string

getField()

public getField(string $expr) : array<string|int, mixed>|null
Parameters
$expr : string
Return values
array<string|int, mixed>|null

getGroupBy()

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>

getOrderBy()

public getOrderBy() : array<string|int, mixed>
Return values
array<string|int, mixed>

getResults()

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
throws
CRM_Core_Exception
Return values
string

getWhere()

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
throws
CRM_Core_Exception
uses
composeClause()

to generate the SQL etc.

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.

buildSelectClause()

Select * from all sets

protected buildSelectClause() : 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
throws
Exception
Return values
array<string|int, mixed>|string|null

isAggregateQuery()

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|string

        
On this page

Search results