1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
chatpinnedmessage.php
См. документацию.
1<?php
2namespace Bitrix\Im\Model;
3
4use Bitrix\Im\Model\ChatTable;
5use Bitrix\Im\Model\MessageTable;
6use Bitrix\Im\Model\UserTable;
7use Bitrix\Main\ORM\Data\DataManager;
8use Bitrix\Main\ORM\Fields\DatetimeField;
9use Bitrix\Main\ORM\Fields\IntegerField;
10use Bitrix\Main\ORM\Fields\Relations\Reference;
11use Bitrix\Main\ORM\Query\Join;
12use Bitrix\Main\Type\DateTime;
13
41
43{
49 public static function getTableName()
50 {
51 return 'b_im_chat_pinned_message';
52 }
53
59 public static function getMap()
60 {
61 return [
62 'ID' => new IntegerField(
63 'ID',
64 [
65 'primary' => true,
66 'autocomplete' => true,
67 ]
68 ),
69 'CHAT_ID' => new IntegerField(
70 'CHAT_ID',
71 []
72 ),
73 'MESSAGE_ID' => new IntegerField(
74 'MESSAGE_ID',
75 []
76 ),
77 'PIN_AUTHOR_ID' => new IntegerField(
78 'PIN_AUTHOR_ID',
79 []
80 ),
81 'DATE_CREATE' => new DatetimeField(
82 'DATE_CREATE',
83 [
84 'required' => true,
85 'default_value' => static function() {
86 return new DateTime();
87 }
88 ]
89 ),
90 'MESSAGE' => (new Reference(
91 'MESSAGE',
92 MessageTable::class,
93 Join::on('this.MESSAGE_ID', 'ref.ID')
94 ))->configureJoinType(Join::TYPE_INNER),
95 'CHAT' => (new Reference(
96 'CHAT',
97 ChatTable::class,
98 Join::on('this.CHAT_ID', 'ref.ID')
99 ))->configureJoinType(Join::TYPE_INNER),
100 'PIN_AUTHOR' => (new Reference(
101 'PIN_AUTHOR',
102 UserTable::class,
103 Join::on('this.PIN_AUTHOR_ID', 'ref.ID')
104 ))->configureJoinType(Join::TYPE_LEFT)
105 ];
106 }
107}