1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
relation.php
См. документацию.
1<?php
2namespace Bitrix\Im\Model;
3
4use Bitrix\Im\Internals\Query;
5use Bitrix\Im\V2\Common\UpdateByFilterTrait;
6use Bitrix\Main\Application;
7use Bitrix\Main\Entity;
8use Bitrix\Main\ORM\Data\Internal\DeleteByFilterTrait;
9
10
50
51class RelationTable extends Entity\DataManager
52{
53 use DeleteByFilterTrait;
54 use UpdateByFilterTrait;
55
61 public static function getTableName()
62 {
63 return 'b_im_relation';
64 }
65
71 public static function getMap()
72 {
73 return array(
74 'ID' => array(
75 'data_type' => 'integer',
76 'primary' => true,
77 'autocomplete' => true,
78 //'title' => Loc::getMessage('RELATION_ENTITY_ID_FIELD'),
79 ),
80 'CHAT_ID' => array(
81 'data_type' => 'integer',
82 'required' => true,
83 //'title' => Loc::getMessage('RELATION_ENTITY_CHAT_ID_FIELD'),
84 ),
85 'MESSAGE_TYPE' => array(
86 'data_type' => 'string',
87 'validation' => array(__CLASS__, 'validateMessageType'),
88 //'title' => Loc::getMessage('RELATION_ENTITY_MESSAGE_TYPE_FIELD'),
89 ),
90 'USER_ID' => array(
91 'data_type' => 'integer',
92 'required' => true,
93 //'title' => Loc::getMessage('RELATION_ENTITY_USER_ID_FIELD'),
94 ),
95 'START_ID' => array(
96 'data_type' => 'integer',
97 //'title' => Loc::getMessage('RELATION_ENTITY_START_ID_FIELD'),
98 ),
99 'LAST_ID' => array(
100 'data_type' => 'integer',
101 //'title' => Loc::getMessage('RELATION_ENTITY_LAST_ID_FIELD'),
102 ),
103 'UNREAD_ID' => array(
104 'data_type' => 'integer',
105 //'title' => Loc::getMessage('RELATION_ENTITY_UNREAD_ID_FIELD'),
106 'default' => 0
107 ),
108 'LAST_SEND_ID' => array(
109 'data_type' => 'integer',
110 //'title' => Loc::getMessage('RELATION_ENTITY_LAST_SEND_ID_FIELD'),
111 ),
112 'LAST_SEND_MESSAGE_ID' => array(
113 'data_type' => 'integer',
114 ),
115 'REASON' => array(
116 'data_type' => 'string',
117 'default_value' => '',
118 'validation' => array(__CLASS__, 'validateReason'),
119 ),
120 'IS_HIDDEN' => array(
121 'data_type' => 'boolean',
122 'values' => array('N', 'Y'),
123 'default_value' => 'N',
124 ),
125 'LAST_FILE_ID' => array(
126 'data_type' => 'integer',
127 //'title' => Loc::getMessage('RELATION_ENTITY_LAST_FILE_ID_FIELD'),
128 ),
129 'LAST_READ' => array(
130 'data_type' => 'datetime',
131 //'title' => Loc::getMessage('RELATION_ENTITY_LAST_READ_FIELD'),
132 ),
133 'STATUS' => array(
134 'data_type' => 'integer',
135 //'title' => Loc::getMessage('RELATION_ENTITY_STATUS_FIELD'),
136 ),
137 'CALL_STATUS' => array(
138 'data_type' => 'integer',
139 //'title' => Loc::getMessage('RELATION_ENTITY_CALL_STATUS_FIELD'),
140 ),
141 'MESSAGE_STATUS' => array(
142 'data_type' => 'string',
143 'default_value' => IM_MESSAGE_STATUS_RECEIVED,
144 'validation' => array(__CLASS__, 'validateMessageStatus'),
145 ),
146 'NOTIFY_BLOCK' => array(
147 'data_type' => 'boolean',
148 'values' => array('N', 'Y'),
149 //'title' => Loc::getMessage('RELATION_ENTITY_NOTIFY_BLOCK_FIELD'),
150 ),
151 'MANAGER' => array(
152 'data_type' => 'boolean',
153 'values' => array('N', 'Y'),
154 'default_value' => 'N',
155 ),
156 'COUNTER' => array(
157 'data_type' => 'integer',
158 'default_value' => 0,
159 ),
160 'START_COUNTER' => array(
161 'data_type' => 'integer',
162 'default_value' => 0,
163 ),
164 'CHAT' => array(
165 'data_type' => 'Bitrix\Im\Model\ChatTable',
166 'reference' => array('=this.CHAT_ID' => 'ref.ID'),
167 ),
168 'START' => array(
169 'data_type' => 'Bitrix\Im\Model\MessageTable',
170 'reference' => array('=this.START_ID' => 'ref.ID'),
171 ),
172 'LAST_SEND' => array(
173 'data_type' => 'Bitrix\Im\Model\MessageTable',
174 'reference' => array('=this.LAST_SEND_ID' => 'ref.ID'),
175 ),
176 'LAST' => array(
177 'data_type' => 'Bitrix\Im\Model\MessageTable',
178 'reference' => array('=this.LAST_ID' => 'ref.ID'),
179 ),
180 'USER' => array(
181 'data_type' => 'Bitrix\Im\Model\UserTable',
182 'reference' => array('=this.USER_ID' => 'ref.ID'),
183 ),
184 );
185 }
186
192 public static function validateMessageType()
193 {
194 return array(
195 new Entity\Validator\Length(null, 1),
196 );
197 }
198
204 public static function validateMessageStatus()
205 {
206 return array(
207 new Entity\Validator\Length(null, 50),
208 );
209 }
210
216 public static function validateReason()
217 {
218 return array(
219 new Entity\Validator\Length(null, 50),
220 );
221 }
222
227 public static function generateSearchContent(array $fields)
228 {
230 ->addText($fields['TITLE'])
231 ->build();
232
233 return $result;
234 }
235
239 public static function deleteBatch(array $filter, $limit = 0): int
240 {
241 /*
242 $tableName = static::getTableName();
243 $connection = Application::getConnection();
244 $sqlHelper = $connection->getSqlHelper();
245
246 $query = new Query(static::getEntity());
247 $query->setFilter($filter);
248 $query->getQuery();
249
250 $alias = $sqlHelper->quote($query->getInitAlias()) . '.';
251 $where = str_replace($alias, '', $query->getWhere());
252
253 $sql = 'DELETE FROM ' . $tableName . ' WHERE ' . $where;
254 if($limit > 0)
255 {
256 $sql .= ' LIMIT ' . $limit;
257 }
258
259 $connection->queryExecute($sql);
260 */
261
262 $connection = Application::getConnection();
263
264 static::deleteByFilter($filter);
265
266 return $connection->getAffectedRowsCount();
267 }
268}
$connection
Определения actionsdefinitions.php:38
static validateMessageStatus()
Определения relation.php:204
static deleteBatch(array $filter, $limit=0)
Определения relation.php:239
static getMap()
Определения relation.php:71
static validateReason()
Определения relation.php:216
static validateMessageType()
Определения relation.php:192
static generateSearchContent(array $fields)
Определения relation.php:227
static getTableName()
Определения relation.php:61
static create()
Определения mapbuilder.php:25
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$filter
Определения iblock_catalog_list.php:54
const IM_MESSAGE_STATUS_RECEIVED
Определения include.php:44
Определения ufield.php:9
$fields
Определения yandex_run.php:501