Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
searchquery.php
1
<?
2
namespace
Bitrix\UI\EntitySelector
;
3
4
class
SearchQuery
implements
\JsonSerializable
5
{
6
protected
$queryWords
= [];
7
protected
$query
=
''
;
8
protected
$cacheable
=
true
;
9
protected
$dynamicSearchEntities
= [];
10
protected
$rawQuery
=
''
;
11
12
public
function
__construct
(array $options)
13
{
14
if
(isset($options[
'queryWords'
]) && is_array($options[
'queryWords'
]))
15
{
16
$this->
setQueryWords
($options[
'queryWords'
]);
17
}
18
19
if
(isset($options[
'cacheable'
]) && is_bool($options[
'cacheable'
]))
20
{
21
$this->
setCacheable
($options[
'cacheable'
]);
22
}
23
24
if
(isset($options[
'dynamicSearchEntities'
]) && is_array($options[
'dynamicSearchEntities'
]))
25
{
26
$this->
setDynamicSearchEntities
($options[
'dynamicSearchEntities'
]);
27
}
28
29
if
(isset($options[
'query'
]) && is_string($options[
'query'
]))
30
{
31
$this->
setRawQuery
($options[
'query'
]);
32
}
33
}
34
35
public
function
getQueryWords
(): array
36
{
37
return
$this->queryWords
;
38
}
39
40
public
function
getQuery
(): string
41
{
42
return
$this->query
;
43
}
44
45
protected
function
setQueryWords
(array
$queryWords
)
46
{
47
foreach
(
$queryWords
as $queryWord)
48
{
49
if
(is_string($queryWord) && mb_strlen(trim($queryWord)) > 0)
50
{
51
$this->queryWords[] = trim($queryWord);
52
$this->query = join(
' '
, $this->queryWords);
53
}
54
}
55
}
56
57
public
function
isCacheable
(): bool
58
{
59
return
$this->cacheable
;
60
}
61
62
public
function
setDynamicSearchEntities
(array $entities): void
63
{
64
$this->dynamicSearchEntities = $entities;
65
}
66
67
public
function
hasDynamicSearchEntity
(
string
$entityId): bool
68
{
69
return
in_array($entityId, $this->dynamicSearchEntities);
70
}
71
72
public
function
setCacheable
(
bool
$flag =
true
)
73
{
74
if
(is_bool($flag))
75
{
76
$this->cacheable = $flag;
77
}
78
79
return
$this;
80
}
81
82
public
function
jsonSerialize
()
83
{
84
return
[
85
'queryWords'
=> $this->
getQueryWords
(),
86
'cacheable'
=> $this->
isCacheable
()
87
];
88
}
89
90
public
function
getRawQuery
(): string
91
{
92
return
$this->rawQuery
;
93
}
94
95
protected
function
setRawQuery
(
string
$rawQuery
): void
96
{
97
$this->rawQuery =
$rawQuery
;
98
}
99
}
Bitrix\UI\EntitySelector\SearchQuery
Definition
searchquery.php:5
Bitrix\UI\EntitySelector\SearchQuery\__construct
__construct(array $options)
Definition
searchquery.php:12
Bitrix\UI\EntitySelector\SearchQuery\$rawQuery
$rawQuery
Definition
searchquery.php:10
Bitrix\UI\EntitySelector\SearchQuery\hasDynamicSearchEntity
hasDynamicSearchEntity(string $entityId)
Definition
searchquery.php:67
Bitrix\UI\EntitySelector\SearchQuery\setRawQuery
setRawQuery(string $rawQuery)
Definition
searchquery.php:95
Bitrix\UI\EntitySelector\SearchQuery\getQuery
getQuery()
Definition
searchquery.php:40
Bitrix\UI\EntitySelector\SearchQuery\setQueryWords
setQueryWords(array $queryWords)
Definition
searchquery.php:45
Bitrix\UI\EntitySelector\SearchQuery\$cacheable
$cacheable
Definition
searchquery.php:8
Bitrix\UI\EntitySelector\SearchQuery\isCacheable
isCacheable()
Definition
searchquery.php:57
Bitrix\UI\EntitySelector\SearchQuery\setCacheable
setCacheable(bool $flag=true)
Definition
searchquery.php:72
Bitrix\UI\EntitySelector\SearchQuery\$dynamicSearchEntities
$dynamicSearchEntities
Definition
searchquery.php:9
Bitrix\UI\EntitySelector\SearchQuery\setDynamicSearchEntities
setDynamicSearchEntities(array $entities)
Definition
searchquery.php:62
Bitrix\UI\EntitySelector\SearchQuery\$queryWords
$queryWords
Definition
searchquery.php:6
Bitrix\UI\EntitySelector\SearchQuery\getQueryWords
getQueryWords()
Definition
searchquery.php:35
Bitrix\UI\EntitySelector\SearchQuery\jsonSerialize
jsonSerialize()
Definition
searchquery.php:82
Bitrix\UI\EntitySelector\SearchQuery\getRawQuery
getRawQuery()
Definition
searchquery.php:90
Bitrix\UI\EntitySelector\SearchQuery\$query
$query
Definition
searchquery.php:7
Bitrix\UI\EntitySelector
Definition
basefilter.php:2
modules
ui
lib
entityselector
searchquery.php
Создано системой
1.10.0