1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
messageunread.php
См. документацию.
1<?php
2namespace Bitrix\Im\Model;
3
4use Bitrix\Im\Internals\Query;
5use Bitrix\Im\V2\Common\InsertSelectTrait;
6use Bitrix\Im\V2\Common\MultiplyInsertTrait;
7use Bitrix\Im\V2\Common\UpdateByFilterTrait;
8use Bitrix\Main\Application;
9use Bitrix\Main\ORM\Data\DataManager;
10use Bitrix\Main\ORM\Data\Internal\DeleteByFilterTrait;
11use Bitrix\Main\ORM\Data\Internal\MergeTrait;
12use Bitrix\Main\ORM\Fields\BooleanField;
13use Bitrix\Main\ORM\Fields\DatetimeField;
14use Bitrix\Main\ORM\Fields\IntegerField;
15use Bitrix\Main\ORM\Fields\Relations\Reference;
16use Bitrix\Main\ORM\Fields\StringField;
17use Bitrix\Main\ORM\Query\Filter\Expressions\ColumnExpression;
18use Bitrix\Main\ORM\Query\Join;
19use Bitrix\Main\Type\DateTime;
20
49
51{
52 use DeleteByFilterTrait;
53 use MergeTrait;
54 use InsertSelectTrait;
55 use MultiplyInsertTrait;
56 use UpdateByFilterTrait;
57
63 public static function getTableName()
64 {
65 return 'b_im_message_unread';
66 }
67
73 public static function getMap()
74 {
75 return [
76 'ID' => new IntegerField(
77 'ID',
78 [
79 'primary' => true,
80 'autocomplete' => true,
81 ]
82 ),
83 'USER_ID' => new IntegerField(
84 'USER_ID',
85 [
86 'required' => true,
87 ]
88 ),
89 'CHAT_ID' => new IntegerField(
90 'CHAT_ID',
91 [
92 'required' => true,
93 ]
94 ),
95 'MESSAGE_ID' => new IntegerField(
96 'MESSAGE_ID',
97 [
98 'required' => true,
99 ]
100 ),
101 'IS_MUTED' => new BooleanField(
102 'IS_MUTED',
103 [
104 'required' => true,
105 'values' => array('N', 'Y'),
106 ]
107 ),
108 'CHAT_TYPE' => new StringField(
109 'CHAT_TYPE',
110 [
111 'required' => true,
112 ]
113 ),
114 'DATE_CREATE' => new DatetimeField(
115 'DATE_CREATE',
116 [
117 'default' => function()
118 {
119 return new DateTime();
120 },
121 ]
122 ),
123 'PARENT_ID' => new IntegerField(
124 'PARENT_ID',
125 [
126 'required' => true,
127 ]
128 ),
129 ];
130 }
131
132 public static function updateBatch(array $fields, array $filter): void
133 {
134 $tableName = static::getTableName();
135 $connection = Application::getConnection();
136 $sqlHelper = $connection->getSqlHelper();
137
138 $update = $sqlHelper->prepareUpdate($tableName, $fields);
139
140 $query = new Query(static::getEntity());
141 $query->setFilter($filter);
142 $query->getQuery();
143
144 $alias = $sqlHelper->quote($query->getInitAlias()) . '.';
145 $where = str_replace($alias, '', $query->getWhere());
146
147 $sql = 'UPDATE ' . $tableName . ' SET ' . $update[0] . ' WHERE ' . $where;
148 $connection->queryExecute($sql, $update[1]);
149 }
150}
$connection
Определения actionsdefinitions.php:38
static updateBatch(array $fields, array $filter)
Определения messageunread.php:132
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$query
Определения get_search.php:11
$filter
Определения iblock_catalog_list.php:54
Определения chain.php:3
$fields
Определения yandex_run.php:501