Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
reaction.php
1<?php
2namespace Bitrix\Im\Model;
3
5use Bitrix\Main\ORM\Data\Internal\DeleteByFilterTrait;
11
42{
43 use DeleteByFilterTrait;
44
50 public static function getTableName()
51 {
52 return 'b_im_reaction';
53 }
54
60 public static function getMap()
61 {
62 return [
63 'ID' => new IntegerField(
64 'ID',
65 [
66 'primary' => true,
67 'autocomplete' => true,
68 ]
69 ),
70 'CHAT_ID' => new IntegerField(
71 'CHAT_ID',
72 [
73 'required' => true,
74 ]
75 ),
76 'MESSAGE_ID' => new IntegerField(
77 'MESSAGE_ID',
78 [
79 'required' => true,
80 ]
81 ),
82 'USER_ID' => new IntegerField(
83 'USER_ID',
84 [
85 'required' => true,
86 ]
87 ),
88 'REACTION' => new StringField(
89 'REACTION',
90 [
91 'required' => true,
92 'validation' => [__CLASS__, 'validateReaction'],
93 ]
94 ),
95 'DATE_CREATE' => new DatetimeField(
96 'DATE_CREATE',
97 [
98 'required' => true,
99 ]
100 ),
101 'COUNT' => (new ExpressionField(
102 'COUNT',
103 'COUNT(*)'
104 ))->configureValueType(IntegerField::class),
105 ];
106 }
107
113 public static function validateReaction(): array
114 {
115 return [
116 new LengthValidator(null, 50),
117 ];
118 }
119}