Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
builder.php
1
<?php
2
3
namespace
Bitrix\Sender\Search
;
4
5
use
Bitrix\Main\Entity
;
6
11
class
Builder
12
{
14
private
$entity;
15
17
private
$content;
18
20
private
$fieldName;
21
28
public
function
__construct
(
Entity
\
Base
$entity, $fieldName)
29
{
30
$this->entity = $entity;
31
$this->fieldName = $fieldName;
32
}
33
39
public
function
isFullTextIndexEnabled
()
40
{
41
return
$this->entity->fullTextIndexEnabled($this->fieldName);
42
}
43
49
public
function
hasField
()
50
{
51
return
$this->entity->hasField($this->fieldName);
52
}
53
59
public
function
getContent
()
60
{
61
if
(!$this->content)
62
{
63
$this->content =
new
Content
;
64
}
65
66
return
$this->content;
67
}
68
74
public
function
isEnabled
()
75
{
76
return
$this->
hasField
() && $this->
isFullTextIndexEnabled
();
77
}
78
85
public
function
save
($entityId)
86
{
87
$dataClass = $this->entity->getDataClass();
88
return
$dataClass::update(
89
$entityId,
90
array($this->fieldName => $this->content->getString())
91
)->isSuccess();
92
}
93
101
public
function
applyFilter
(array &$filter, $searchString)
102
{
103
if
(!$searchString)
104
{
105
return
false
;
106
}
107
if
(!$this->
hasField
())
108
{
109
return
false
;
110
}
111
112
$isFullTextEnabled = $this->
isFullTextIndexEnabled
();
113
$operation = $isFullTextEnabled ?
'*'
:
'*%'
;
114
$filter[
"{$operation}{$this->fieldName}"
] =
Content::encodeText
($searchString);
115
116
return
true
;
117
}
118
}
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Sender\Connector\Base
Definition
base.php:13
Bitrix\Sender\Posting\Builder
Definition
builder.php:39
Bitrix\Sender\Search\Builder\__construct
__construct(Entity\Base $entity, $fieldName)
Definition
builder.php:28
Bitrix\Sender\Search\Builder\getContent
getContent()
Definition
builder.php:59
Bitrix\Sender\Search\Builder\hasField
hasField()
Definition
builder.php:49
Bitrix\Sender\Search\Builder\save
save($entityId)
Definition
builder.php:85
Bitrix\Sender\Search\Builder\isFullTextIndexEnabled
isFullTextIndexEnabled()
Definition
builder.php:39
Bitrix\Sender\Search\Builder\applyFilter
applyFilter(array &$filter, $searchString)
Definition
builder.php:101
Bitrix\Sender\Search\Builder\isEnabled
isEnabled()
Definition
builder.php:74
Bitrix\Sender\Search\Content
Definition
content.php:13
Bitrix\Sender\Search\Content\encodeText
static encodeText($text)
Definition
content.php:32
Bitrix\Sender\Search
Definition
builder.php:3
modules
sender
lib
search
builder.php
Создано системой
1.10.0