7trait SidebarFilterProcessorTrait
9 protected static function processSidebarFilters(Query $query, array $filter, array $order, $fieldsMap = []): void
11 if (isset($filter[
'USER_ID']))
13 $query->whereIn($fieldsMap[
'AUTHOR_ID'] ??
'AUTHOR_ID', $filter[
'USER_ID']);
16 if (isset($filter[
'LAST_ID']))
18 $operator = $order[$fieldsMap[
'ID'] ??
'ID'] ===
'DESC' ?
'<' :
'>';
19 $query->where($fieldsMap[
'ID'] ??
'ID', $operator, $filter[
'LAST_ID']);
22 if (isset($filter[
'CHAT_ID']))
24 $query->where($fieldsMap[
'CHAT_ID'] ??
'CHAT_ID', $filter[
'CHAT_ID']);
27 if (isset($filter[
'DATE_FROM']))
29 $query->where($fieldsMap[
'DATE_CREATE'] ??
'DATE_CREATE',
'>=', $filter[
'DATE_FROM']);
32 if (isset($filter[
'DATE_TO']))
34 $query->where($fieldsMap[
'DATE_CREATE'] ??
'DATE_CREATE',
'<=', $filter[
'DATE_TO']);
37 if (isset($filter[
'START_ID']) && (
int)$filter[
'START_ID'] > 0)
39 $query->where($fieldsMap[
'MESSAGE_ID'] ??
'MESSAGE_ID',
'>=', $filter[
'START_ID']);