RawQueryObserverUnionResult implements ResultOption uses UnionUtils
FinalYes
When forming security subqueries in some cases when selecting from ATTR tables, instead of using JOIN with the observer table, it will be more productive to use UNION ALL to obtain a list of ENTITY_IDs available to the user.
This class is an analogue of Bitrix\Crm\Security\QueryBuilder\Result\RawQueryResult and if something could not be generated, it uses it to generate the result.
result example:
SELECT p.`ENTITY_ID` AS `ENTITY_ID`
FROM (SELECT o.`ENTITY_ID` AS `ENTITY_ID`
FROM `b_crm_observer` o
INNER JOIN `b_crm_access_attr_contact` oa ON o.`ENTITY_ID` = oa.`ENTITY_ID` AND oa.`CATEGORY_ID` IN (0)
WHERE o.`ENTITY_TYPE_ID` = 3 AND o.`USER_ID` = 3
UNION ALL
SELECT `P`.`ENTITY_ID` AS `ENTITY_ID`
FROM `b_crm_access_attr_contact` `P`
WHERE (`P`.`USER_ID` IN (3, 7, 8) AND `P`.`CATEGORY_ID` IN (0))
) p
ORDER BY `ENTITY_ID` ASC
LIMIT 0, 10;
Tags
Table of Contents
Interfaces
Methods
- __construct() : mixed
- getIdentityColumnName() : string
- getLimit() : int|null
- getOrder() : string|null
- isUseDistinct() : bool
- make() : string
- makeCompatible() : string
Methods
__construct()
public
__construct([string|null $order = null ][, int|null $limit = null ][, bool $useDistinct = false ][, string $identityColumnName = 'ID' ]) : mixed
Parameters
- $order : string|null = null
- $limit : int|null = null
- $useDistinct : bool = false
- $identityColumnName : string = 'ID'
getIdentityColumnName()
public
getIdentityColumnName() : string
Return values
stringgetLimit()
public
getLimit() : int|null
Return values
int|nullgetOrder()
public
getOrder() : string|null
Return values
string|nullisUseDistinct()
public
isUseDistinct() : bool
Return values
boolmake()
public
make(Entity $entity, RestrictedConditionsList $conditions[, string $prefix = '' ]) : string
Parameters
- $entity : Entity
- $conditions : RestrictedConditionsList
- $prefix : string = ''
Return values
stringmakeCompatible()
public
makeCompatible(string $querySql[, string $prefix = '' ]) : string
Parameters
- $querySql : string
- $prefix : string = ''