Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
linkfile.php
1<?php
2namespace Bitrix\Im\Model;
3
4use Bitrix\Disk\Internals\FileTable;
6use Bitrix\Main\ORM\Data\Internal\DeleteByFilterTrait;
14
46{
47 use DeleteByFilterTrait;
48
54 public static function getTableName()
55 {
56 return 'b_im_link_file';
57 }
58
64 public static function getMap()
65 {
66 return [
67 'ID' => new IntegerField(
68 'ID',
69 [
70 'primary' => true,
71 'autocomplete' => true,
72 ]
73 ),
74 'MESSAGE_ID' => new IntegerField(
75 'MESSAGE_ID',
76 [
77 ]
78 ),
79 'CHAT_ID' => new IntegerField(
80 'CHAT_ID',
81 [
82 ]
83 ),
84 'SUBTYPE' => new StringField(
85 'SUBTYPE',
86 [
87 'validation' => [__CLASS__, 'validateSubtype'],
88 ]
89 ),
90 'DISK_FILE_ID' => new IntegerField(
91 'DISK_FILE_ID',
92 [
93 ]
94 ),
95 'DATE_CREATE' => new DatetimeField(
96 'DATE_CREATE',
97 [
98 'required' => true,
99 'default_value' => static function() {
100 return new DateTime();
101 }
102 ]
103 ),
104 'AUTHOR_ID' => new IntegerField(
105 'AUTHOR_ID',
106 [
107 'required' => true,
108 ]
109 ),
110 'FILE' => (new Reference(
111 'FILE',
112 FileTable::class,
113 Join::on('this.DISK_FILE_ID', 'ref.ID')
114 ))->configureJoinType(Join::TYPE_INNER),
115 ];
116 }
117
123 public static function validateSubtype(): array
124 {
125 return [
126 new LengthValidator(null, 50),
127 ];
128 }
129}