Query extends Query
Separate query to fix PropertyValue emulation in 2.0 Collapses similar joins to b_iblock_element_prop_sX table into one join
Tags
Table of Contents
Methods
- __call() : $this
- __clone() : mixed
- __construct() : mixed
- addFilter() : $this
- Adds a filter for WHERE clause
- addGroup() : $this
- Adds a field to the list of fields for GROUP BY clause
- addOrder() : $this
- Adds a filed to the list of fields for ORDER BY clause
- addSelect() : $this
- Adds a field for SELECT clause
- addUnionOrder() : $this
- General order for all the union queries.
- booleanStrongEqualityCallback() : mixed
- buildFilterSql() : string
- Builds SQL filter conditions for WHERE.
- cacheJoins() : $this
- Enables or disables caching of queries with joins.
- countTotal() : mixed
- dataDoublingCallback() : mixed
- disableDataDoubling() : $this
- Replaces all 1:N relations in filter to ID IN (subquery SELECT ID FROM <1:N relation>) Available for Entities with 1 primary field only
- disablePrivateFields() : $this
- Restricts private fields in query
- dump() : mixed
- enableDataDoubling() : $this
- enablePrivateFields() : $this
- Allows private fields in query
- exec() : Result
- Builds and executes the query and returns the result
- expr() : Expression
- Used to create ExpressionField in a short way.
- fetch() : array<string|int, mixed>|false
- Short alias for $result->fetch()
- fetchAll() : array<string|int, mixed>
- Short alias for $result->fetchAll()
- fetchCollection() : null
- Short alias for $result->fetchCollection()
- fetchDataModificationCallback() : mixed
- Being called in Db\Result as a data fetch modifier
- fetchObject() : null
- Short alias for $result->fetchObject()
- filter() : ConditionTree
- Returns new instance of Filter.
- getChains() : array<string|int, mixed>|array<string|int, Chain>
- getEntity() : mixed
- getFilter() : array<string|int, mixed>
- Returns an array of filters for WHERE clause
- getFilterChains() : array<string|int, mixed>|array<string|int, Chain>
- getFilterHandler() : ConditionTree
- getGroup() : array<string|int, mixed>
- Returns an array of fields for GROUP BY clause
- getGroupChains() : array<string|int, mixed>|array<string|int, Chain>
- getHavingChains() : array<string|int, mixed>|array<string|int, Chain>
- getHiddenChains() : array<string|int, mixed>
- getInitAlias() : string
- getJoinMap() : mixed
- getLastQuery() : string
- Returns last executed query string
- getLimit() : null|int
- Returns a limit
- getOffset() : null|int
- Returns an offset
- getOrder() : array<string|int, mixed>
- Returns an array of fields for ORDER BY clause
- getOrderChains() : array<string|int, mixed>|array<string|int, Chain>
- getQuery() : string
- Builds and returns SQL query string
- getRegisteredChain() : Chain|bool
- getReplacedAliases() : mixed
- getRuntimeChains() : array<string|int, Chain>
- getSelect() : array<string|int, mixed>
- Returns an array of fields for SELECT clause
- getSelectChains() : array<string|int, mixed>|array<string|int, Chain>
- getTableAliasPostfix() : mixed
- getWhereChains() : array<string|int, mixed>|array<string|int, Chain>
- hasAggregation() : mixed
- hasBackReference() : bool
- hasDistinct() : mixed
- having() : $this
- havingBetween() : $this
- havingColumn() : $this
- havingExists() : $this
- havingIn() : $this
- havingLike() : $this
- havingNot() : $this
- havingNotBetween() : $this
- havingNotExists() : $this
- havingNotIn() : $this
- havingNotLike() : $this
- havingNotNull() : $this
- havingNull() : $this
- isFetchModificationRequired() : bool
- Check if fetch data modification required, also caches modifier-callbacks
- isFieldPrivate() : bool
- isPrivateFieldsEnabled() : bool
- nullEqualityCallback() : mixed
- queryCountTotal() : mixed
- quoteTableSource() : string
- registerChain() : mixed
- registerRuntimeField() : $this
- Adds a runtime field (being created dynamically, opposite to being described statically in the entity map)
- setCacheTtl() : mixed
- setCustomBaseTableAlias() : $this
- Sets a custom alias for the table of the init entity
- setDistinct() : mixed
- setFilter() : $this
- Sets a list of filters for WHERE clause
- setFilterChains() : mixed
- setFilterHandlerChains() : mixed
- setGroup() : $this
- Sets a list of fields in GROUP BY clause
- setLimit() : $this
- Sets a limit for LIMIT n clause
- setOffset() : $this
- Sets an offset for LIMIT n, m clause
- setOrder() : $this
- Sets a list of fields for ORDER BY clause.
- setSelect() : Query
- Sets a list of fields for SELECT clause
- setTableAliasPostfix() : mixed
- setUnionLimit() : $this
- General limit for all the union queries.
- setUnionOffset() : $this
- General offset for all the union queries.
- setUnionOrder() : $this
- General order for all the union queries.
- union() : $this
- Puts additional query to union with current.
- unionAll() : $this
- Puts additional query to union (all) with current.
- where() : $this
- whereBetween() : $this
- whereColumn() : $this
- whereExists() : $this
- whereExpr() : $this
- whereIn() : $this
- whereLike() : $this
- whereMatch() : $this
- whereNot() : $this
- whereNotBetween() : $this
- whereNotExists() : $this
- whereNotIn() : $this
- whereNotLike() : $this
- whereNotMatch() : $this
- whereNotNull() : $this
- whereNull() : $this
Methods
__call()
public
__call(mixed $method, mixed $arguments) : $this
Parameters
- $method : mixed
- $arguments : mixed
Tags
Return values
$this__clone()
public
__clone() : mixed
__construct()
public
__construct(Entity|Query|string $source) : mixed
Parameters
Tags
addFilter()
Adds a filter for WHERE clause
public
addFilter(string $key, mixed $value) : $this
Parameters
- $key : string
- $value : mixed
Return values
$thisaddGroup()
Adds a field to the list of fields for GROUP BY clause
public
addGroup(mixed $group) : $this
Parameters
- $group : mixed
Return values
$thisaddOrder()
Adds a filed to the list of fields for ORDER BY clause
public
addOrder(string $definition[, string $order = 'ASC' ]) : $this
Parameters
- $definition : string
- $order : string = 'ASC'
Tags
Return values
$thisaddSelect()
Adds a field for SELECT clause
public
addSelect(mixed $definition[, string $alias = '' ]) : $this
Parameters
- $definition : mixed
-
Field
- $alias : string = ''
-
Field alias like SELECT field AS alias
Return values
$thisaddUnionOrder()
General order for all the union queries.
public
addUnionOrder(string $definition[, string $order = 'ASC' ]) : $this
Has the same format as Query::addOrder().
Parameters
- $definition : string
- $order : string = 'ASC'
Tags
Return values
$thisbooleanStrongEqualityCallback()
public
booleanStrongEqualityCallback(mixed $field, mixed $operation, mixed $value) : mixed
Parameters
- $field : mixed
- $operation : mixed
- $value : mixed
buildFilterSql()
Builds SQL filter conditions for WHERE.
public
static buildFilterSql(Entity $entity, array<string|int, mixed>|ConditionTree $filter) : string
Useful for external calls: building SQL for mass UPDATEs or DELETEs
Parameters
- $entity : Entity
- $filter : array<string|int, mixed>|ConditionTree
-
the same format as for setFilter/where
Tags
Return values
stringcacheJoins()
Enables or disables caching of queries with joins.
public
cacheJoins(bool $mode) : $this
Parameters
- $mode : bool
Return values
$thiscountTotal()
public
countTotal([mixed $count = null ]) : mixed
Parameters
- $count : mixed = null
dataDoublingCallback()
public
dataDoublingCallback(mixed $field, mixed $operation, mixed $value) : mixed
Parameters
- $field : mixed
- $operation : mixed
- $value : mixed
disableDataDoubling()
Replaces all 1:N relations in filter to ID IN (subquery SELECT ID FROM <1:N relation>) Available for Entities with 1 primary field only
public
disableDataDoubling() : $this
Return values
$thisdisablePrivateFields()
Restricts private fields in query
public
disablePrivateFields() : $this
Return values
$thisdump()
public
dump() : mixed
enableDataDoubling()
public
enableDataDoubling() : $this
Tags
Return values
$thisenablePrivateFields()
Allows private fields in query
public
enablePrivateFields() : $this
Return values
$thisexec()
Builds and executes the query and returns the result
public
exec() : Result
Tags
Return values
Resultexpr()
Used to create ExpressionField in a short way.
public
static expr([string|null $alias = null ]) : Expression
Parameters
- $alias : string|null = null
-
Name for ExpressionField
Tags
Return values
Expressionfetch()
Short alias for $result->fetch()
public
fetch([Converter|null $converter = null ]) : array<string|int, mixed>|false
Parameters
- $converter : Converter|null = null
Tags
Return values
array<string|int, mixed>|falsefetchAll()
Short alias for $result->fetchAll()
public
fetchAll([Converter|null $converter = null ]) : array<string|int, mixed>
Parameters
- $converter : Converter|null = null
Tags
Return values
array<string|int, mixed>fetchCollection()
Short alias for $result->fetchCollection()
public
fetchCollection() : null
Tags
Return values
null —Actual type should be annotated by orm:annotate
fetchDataModificationCallback()
Being called in Db\Result as a data fetch modifier
public
fetchDataModificationCallback(mixed &$data) : mixed
Parameters
- $data : mixed
fetchObject()
Short alias for $result->fetchObject()
public
fetchObject() : null
Tags
Return values
null —Actual type should be annotated by orm:annotate
filter()
Returns new instance of Filter.
public
static filter() : ConditionTree
Usage: Query::filter()->where(...)
Alternatively short calls Query::where* can be used.
Tags
Return values
ConditionTreegetChains()
public
getChains() : array<string|int, mixed>|array<string|int, Chain>
Return values
array<string|int, mixed>|array<string|int, Chain>getEntity()
public
getEntity() : mixed
getFilter()
Returns an array of filters for WHERE clause
public
getFilter() : array<string|int, mixed>
Return values
array<string|int, mixed>getFilterChains()
public
getFilterChains() : array<string|int, mixed>|array<string|int, Chain>
Return values
array<string|int, mixed>|array<string|int, Chain>getFilterHandler()
public
getFilterHandler() : ConditionTree
Return values
ConditionTreegetGroup()
Returns an array of fields for GROUP BY clause
public
getGroup() : array<string|int, mixed>
Return values
array<string|int, mixed>getGroupChains()
public
getGroupChains() : array<string|int, mixed>|array<string|int, Chain>
Return values
array<string|int, mixed>|array<string|int, Chain>getHavingChains()
public
getHavingChains() : array<string|int, mixed>|array<string|int, Chain>
Return values
array<string|int, mixed>|array<string|int, Chain>getHiddenChains()
public
getHiddenChains() : array<string|int, mixed>
Return values
array<string|int, mixed>getInitAlias()
public
getInitAlias([bool $withPostfix = true ]) : string
Parameters
- $withPostfix : bool = true
Tags
Return values
stringgetJoinMap()
public
getJoinMap() : mixed
getLastQuery()
Returns last executed query string
public
static getLastQuery() : string
Return values
stringgetLimit()
Returns a limit
public
getLimit() : null|int
Return values
null|intgetOffset()
Returns an offset
public
getOffset() : null|int
Return values
null|intgetOrder()
Returns an array of fields for ORDER BY clause
public
getOrder() : array<string|int, mixed>
Return values
array<string|int, mixed>getOrderChains()
public
getOrderChains() : array<string|int, mixed>|array<string|int, Chain>
Return values
array<string|int, mixed>|array<string|int, Chain>getQuery()
Builds and returns SQL query string
public
getQuery([bool $forceObjectPrimary = false ]) : string
Parameters
- $forceObjectPrimary : bool = false
Tags
Return values
stringgetRegisteredChain()
public
getRegisteredChain(mixed $key[, bool $force_create = false ]) : Chain|bool
Parameters
- $key : mixed
- $force_create : bool = false
Tags
Return values
Chain|boolgetReplacedAliases()
public
getReplacedAliases() : mixed
getRuntimeChains()
public
getRuntimeChains() : array<string|int, Chain>
Return values
array<string|int, Chain>getSelect()
Returns an array of fields for SELECT clause
public
getSelect() : array<string|int, mixed>
Return values
array<string|int, mixed>getSelectChains()
public
getSelectChains() : array<string|int, mixed>|array<string|int, Chain>
Return values
array<string|int, mixed>|array<string|int, Chain>getTableAliasPostfix()
public
getTableAliasPostfix() : mixed
getWhereChains()
public
getWhereChains() : array<string|int, mixed>|array<string|int, Chain>
Return values
array<string|int, mixed>|array<string|int, Chain>hasAggregation()
public
hasAggregation() : mixed
hasBackReference()
public
hasBackReference() : bool
Tags
Return values
boolhasDistinct()
public
hasDistinct() : mixed
having()
public
having(mixed ...$filter) : $this
Parameters
- $filter : mixed
Return values
$thishavingBetween()
public
havingBetween(mixed $column, mixed $valueMin, mixed $valueMax) : $this
Parameters
- $column : mixed
- $valueMin : mixed
- $valueMax : mixed
Return values
$thishavingColumn()
public
havingColumn(mixed ...$filter) : $this
Parameters
- $filter : mixed
Return values
$thishavingExists()
public
havingExists(mixed $query) : $this
Parameters
- $query : mixed
Return values
$thishavingIn()
public
havingIn(mixed $column, mixed $values) : $this
Parameters
- $column : mixed
- $values : mixed
Return values
$thishavingLike()
public
havingLike(mixed $column, mixed $value) : $this
Parameters
- $column : mixed
- $value : mixed
Return values
$thishavingNot()
public
havingNot(mixed ...$filter) : $this
Parameters
- $filter : mixed
Return values
$thishavingNotBetween()
public
havingNotBetween(mixed $column, mixed $valueMin, mixed $valueMax) : $this
Parameters
- $column : mixed
- $valueMin : mixed
- $valueMax : mixed
Return values
$thishavingNotExists()
public
havingNotExists(mixed $query) : $this
Parameters
- $query : mixed
Return values
$thishavingNotIn()
public
havingNotIn(mixed $column, mixed $values) : $this
Parameters
- $column : mixed
- $values : mixed
Return values
$thishavingNotLike()
public
havingNotLike(mixed $column, mixed $value) : $this
Parameters
- $column : mixed
- $value : mixed
Return values
$thishavingNotNull()
public
havingNotNull(mixed $column) : $this
Parameters
- $column : mixed
Return values
$thishavingNull()
public
havingNull(mixed $column) : $this
Parameters
- $column : mixed
Return values
$thisisFetchModificationRequired()
Check if fetch data modification required, also caches modifier-callbacks
public
isFetchModificationRequired() : bool
Tags
Return values
boolisFieldPrivate()
public
static isFieldPrivate(Field|IReadable $field) : bool
Parameters
Tags
Return values
boolisPrivateFieldsEnabled()
public
isPrivateFieldsEnabled() : bool
Return values
boolnullEqualityCallback()
public
nullEqualityCallback(mixed $field, mixed $operation, mixed $value) : mixed
Parameters
- $field : mixed
- $operation : mixed
- $value : mixed
queryCountTotal()
public
queryCountTotal() : mixed
quoteTableSource()
public
quoteTableSource(mixed $source) : string
Parameters
- $source : mixed
Tags
Return values
stringregisterChain()
public
registerChain(mixed $section, Chain $chain[, mixed $opt_key = null ]) : mixed
Parameters
- $section : mixed
- $chain : Chain
- $opt_key : mixed = null
registerRuntimeField()
Adds a runtime field (being created dynamically, opposite to being described statically in the entity map)
public
registerRuntimeField(string|null|Field $name[, array<string|int, mixed>|Field $fieldInfo = null ]) : $this
Parameters
Tags
Return values
$thissetCacheTtl()
public
setCacheTtl(mixed $ttl) : mixed
Parameters
- $ttl : mixed
setCustomBaseTableAlias()
Sets a custom alias for the table of the init entity
public
setCustomBaseTableAlias(string $alias) : $this
Parameters
- $alias : string
Return values
$thissetDistinct()
public
setDistinct([mixed $distinct = true ]) : mixed
Parameters
- $distinct : mixed = true
setFilter()
Sets a list of filters for WHERE clause
public
setFilter(array<string|int, mixed> $filter) : $this
Parameters
- $filter : array<string|int, mixed>
Return values
$thissetFilterChains()
public
setFilterChains(mixed &$filter[, string $section = 'filter' ]) : mixed
Parameters
- $filter : mixed
- $section : string = 'filter'
Tags
setFilterHandlerChains()
public
setFilterHandlerChains(ConditionTree $where[, string $section = 'filter' ]) : mixed
Parameters
- $where : ConditionTree
- $section : string = 'filter'
Tags
setGroup()
Sets a list of fields in GROUP BY clause
public
setGroup(mixed $group) : $this
Parameters
- $group : mixed
Return values
$thissetLimit()
Sets a limit for LIMIT n clause
public
setLimit(int $limit) : $this
Parameters
- $limit : int
Return values
$thissetOffset()
Sets an offset for LIMIT n, m clause
public
setOffset(int $offset) : $this
Parameters
- $offset : int
Return values
$thissetOrder()
Sets a list of fields for ORDER BY clause.
public
setOrder(mixed $order) : $this
Format:
setOrder('ID') -- ORDER BY ID
ASC
setOrder(['ID' => 'DESC', 'NAME' => 'ASC]) -- ORDER BY ID
DESC, NAME
ASC
Parameters
- $order : mixed
Tags
Return values
$thissetSelect()
Sets a list of fields for SELECT clause
public
setSelect(array<string|int, mixed> $select) : Query
Parameters
- $select : array<string|int, mixed>
Return values
QuerysetTableAliasPostfix()
public
setTableAliasPostfix(mixed $postfix) : mixed
Parameters
- $postfix : mixed
setUnionLimit()
General limit for all the union queries.
public
setUnionLimit(mixed $limit) : $this
Parameters
- $limit : mixed
Tags
Return values
$thissetUnionOffset()
General offset for all the union queries.
public
setUnionOffset(mixed $offset) : $this
Parameters
- $offset : mixed
Tags
Return values
$thissetUnionOrder()
General order for all the union queries.
public
setUnionOrder(mixed $order) : $this
Has the same format as Query::setOrder().
Parameters
- $order : mixed
Tags
Return values
$thisunion()
Puts additional query to union with current.
public
union() : $this
Accepts one or more Query / SqlExpression.
Tags
Return values
$thisunionAll()
Puts additional query to union (all) with current.
public
unionAll() : $this
Accepts one or more Query / SqlExpression.
Tags
Return values
$thiswhere()
public
where(mixed ...$filter) : $this
Parameters
- $filter : mixed
Return values
$thiswhereBetween()
public
whereBetween(mixed $column, mixed $valueMin, mixed $valueMax) : $this
Parameters
- $column : mixed
- $valueMin : mixed
- $valueMax : mixed
Return values
$thiswhereColumn()
public
whereColumn(mixed ...$filter) : $this
Parameters
- $filter : mixed
Return values
$thiswhereExists()
public
whereExists(mixed $query) : $this
Parameters
- $query : mixed
Return values
$thiswhereExpr()
public
whereExpr(mixed $expr, mixed $arguments) : $this
Parameters
- $expr : mixed
- $arguments : mixed
Return values
$thiswhereIn()
public
whereIn(mixed $column, mixed $values) : $this
Parameters
- $column : mixed
- $values : mixed
Return values
$thiswhereLike()
public
whereLike(mixed $column, mixed $value) : $this
Parameters
- $column : mixed
- $value : mixed
Return values
$thiswhereMatch()
public
whereMatch(mixed $column, mixed $value) : $this
Parameters
- $column : mixed
- $value : mixed
Return values
$thiswhereNot()
public
whereNot(mixed ...$filter) : $this
Parameters
- $filter : mixed
Return values
$thiswhereNotBetween()
public
whereNotBetween(mixed $column, mixed $valueMin, mixed $valueMax) : $this
Parameters
- $column : mixed
- $valueMin : mixed
- $valueMax : mixed
Return values
$thiswhereNotExists()
public
whereNotExists(mixed $query) : $this
Parameters
- $query : mixed
Return values
$thiswhereNotIn()
public
whereNotIn(mixed $column, mixed $values) : $this
Parameters
- $column : mixed
- $values : mixed
Return values
$thiswhereNotLike()
public
whereNotLike(mixed $column, mixed $value) : $this
Parameters
- $column : mixed
- $value : mixed
Return values
$thiswhereNotMatch()
public
whereNotMatch(mixed $column, mixed $value) : $this
Parameters
- $column : mixed
- $value : mixed
Return values
$thiswhereNotNull()
public
whereNotNull(mixed $column) : $this
Parameters
- $column : mixed
Return values
$thiswhereNull()
public
whereNull(mixed $column) : $this
Parameters
- $column : mixed