Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
segmentdata.php
1
<?php
8
namespace
Bitrix\Sender
;
9
10
use
Bitrix\Main\Access\Entity\DataManager
;
11
use
Bitrix\Main\Localization\Loc
;
12
use
Bitrix\Main\ORM\Query\Query
;
13
use
Bitrix\Main\Type
;
14
use
Bitrix\Sender\Runtime\SegmentDataClearJob
;
15
16
Loc::loadMessages
(__FILE__);
17
18
35
class
SegmentDataTable
extends
DataManager
36
{
40
public
static
function
getTableName
()
41
{
42
return
'b_sender_group_data'
;
43
}
44
48
public
static
function
getMap
()
49
{
50
return
array(
51
'ID'
=> array(
52
'data_type'
=>
'integer'
,
53
'autocomplete'
=>
true
,
54
'primary'
=>
true
,
55
),
56
'GROUP_ID'
=> array(
57
'data_type'
=>
'integer'
,
58
'required'
=>
true
,
59
),
60
'DATE_INSERT'
=> array(
61
'data_type'
=>
'datetime'
,
62
'default_value'
=>
new
Type
\
DateTime
(),
63
'required'
=>
true
,
64
),
65
'CRM_ENTITY_ID'
=> array(
66
'data_type'
=>
'integer'
,
67
'required'
=>
false
,
68
),
69
'FILTER_ID'
=> array(
70
'data_type'
=>
'string'
,
71
'required'
=>
true
,
72
),
73
'NAME'
=> array(
74
'data_type'
=>
'string'
,
75
'required'
=>
false
,
76
),
77
'CRM_ENTITY_TYPE'
=> array(
78
'data_type'
=>
'string'
,
79
'required'
=>
false
,
80
),
81
'CRM_ENTITY_TYPE_ID'
=> array(
82
'data_type'
=>
'integer'
,
83
'required'
=>
false
,
84
),
85
'CONTACT_ID'
=> array(
86
'data_type'
=>
'integer'
,
87
'required'
=>
false
,
88
),
89
'COMPANY_ID'
=> array(
90
'data_type'
=>
'integer'
,
91
'required'
=>
false
,
92
),
93
'EMAIL'
=> array(
94
'data_type'
=>
'string'
,
95
'required'
=>
false
,
96
),
97
'IM'
=> array(
98
'data_type'
=>
'string'
,
99
'required'
=>
false
,
100
),
101
'PHONE'
=> array(
102
'data_type'
=>
'string'
,
103
'required'
=>
false
,
104
),
105
'HAS_EMAIL'
=> array(
106
'data_type'
=>
'string'
,
107
'required'
=>
false
,
108
),
109
'HAS_IMOL'
=> array(
110
'data_type'
=>
'string'
,
111
'required'
=>
false
,
112
),
113
'HAS_PHONE'
=> array(
114
'data_type'
=>
'string'
,
115
'required'
=>
false
,
116
),
117
'SENDER_TYPE_ID'
=> array(
118
'data_type'
=>
'integer'
,
119
'required'
=>
false
,
120
),
121
'GROUP'
=> array(
122
'data_type'
=>
'Bitrix\Sender\GroupTable'
,
123
'reference'
=> array(
'=this.GROUP_ID'
=>
'ref.ID'
),
124
),
125
);
126
}
127
128
public
static
function
deleteByGroupId
(
int
$groupId)
129
{
130
$entity = static::getEntity();
131
$connection = $entity->getConnection();
132
133
$selectedRows = SegmentDataTable::getList([
134
'select'
=> [
'ID'
],
135
'filter'
=> [
'GROUP_ID'
=> $groupId],
136
'limit'
=> 1000,
137
])->fetchAll();
138
139
$idsToDelete = array_column($selectedRows,
'ID'
);
140
if
(empty($idsToDelete))
141
{
142
return
''
;
143
}
144
145
$ids = implode(
','
, $idsToDelete);
146
147
$sql =
"DELETE FROM b_sender_group_data WHERE ID IN ($ids)"
;
148
$connection->queryExecute($sql);
149
150
return
SegmentDataClearJob::getAgentName
($groupId);
151
}
152
}
Bitrix\Main\Access\Entity\DataManager
Definition
datamanager.php:15
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\ORM\Query\Query
Definition
query.php:118
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Sender\Runtime\SegmentDataClearJob
Definition
segmentdataclearjob.php:18
Bitrix\Sender\Runtime\SegmentDataClearJob\getAgentName
static getAgentName(int $groupId)
Definition
segmentdataclearjob.php:70
Bitrix\Sender\SegmentDataTable
Definition
segmentdata.php:36
Bitrix\Sender\SegmentDataTable\getMap
static getMap()
Definition
segmentdata.php:48
Bitrix\Sender\SegmentDataTable\deleteByGroupId
static deleteByGroupId(int $groupId)
Definition
segmentdata.php:128
Bitrix\Sender\SegmentDataTable\getTableName
static getTableName()
Definition
segmentdata.php:40
Bitrix\Main\Type
Definition
collection.php:2
Bitrix\Sender
modules
sender
lib
segmentdata.php
Создано системой
1.10.0