Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
segmentdata.php
1<?php
8namespace Bitrix\Sender;
9
15
16Loc::loadMessages(__FILE__);
17
18
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}
static loadMessages($file)
Definition loc.php:64
static deleteByGroupId(int $groupId)