Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
messageaccess.php
1<?php
2
4
6use Bitrix\Main\ORM\Data\Internal\DeleteByFilterTrait;
7
25{
26 use DeleteByFilterTrait;
27
28 const ENTITY_TYPE_NO_BIND = 'NO_BIND';
29 const ENTITY_TYPE_TASKS_TASK = 'TASKS_TASK';
30 const ENTITY_TYPE_CRM_ACTIVITY = 'CRM_ACTIVITY';
31 const ENTITY_TYPE_BLOG_POST = 'BLOG_POST';
32 const ENTITY_TYPE_IM_CHAT = 'IM_CHAT';
33 const ENTITY_TYPE_CALENDAR_EVENT = 'CALENDAR_EVENT';
34
35 public static function getFilePath()
36 {
37 return __FILE__;
38 }
39
40 public static function getTableName()
41 {
42 return 'b_mail_message_access';
43 }
44
45 public static function getMap()
46 {
47 return array(
48 'TOKEN' => array(
49 'data_type' => 'string',
50 'primary' => true,
51 ),
52 'MAILBOX_ID' => array(
53 'data_type' => 'integer',
54 'required' => true,
55 ),
56 'MESSAGE_ID' => array(
57 'data_type' => 'integer',
58 'required' => true,
59 ),
60 'ENTITY_UF_ID' => array(
61 'data_type' => 'integer',
62 'required' => true,
63 ),
64 'ENTITY_TYPE' => array(
65 'data_type' => 'string',
66 'required' => true,
67 ),
68 'ENTITY_ID' => array(
69 'data_type' => 'integer',
70 'required' => true,
71 ),
72 'SECRET' => array(
73 'data_type' => 'string',
74 'required' => true,
75 ),
76 'OPTIONS' => array(
77 'data_type' => 'text',
78 'serialized' => true,
79 ),
80 new Entity\ReferenceField(
81 'CRM_ACTIVITY',
82 '\Bitrix\Crm\ActivityTable',
83 array(
84 '=this.ENTITY_TYPE' => array('?s', self::ENTITY_TYPE_CRM_ACTIVITY),
85 '=this.ENTITY_ID' => 'ref.ID',
86 )
87 ),
88 );
89 }
90
91
100 public static function getBinds(int $mailboxId, int $messageId): array
101 {
103 ->where('MAILBOX_ID', $mailboxId)
104 ->where('MESSAGE_ID', $messageId)
105 ->setDistinct()
106 ->setSelect([
107 'ENTITY_TYPE',
108 'ENTITY_ID',
109 ])
110 ->fetchAll();
111
112 return array_map(fn(array $bind): string => "{$bind['ENTITY_TYPE']}-{$bind['ENTITY_ID']}", $binds);
113 }
114
115}
static getBinds(int $mailboxId, int $messageId)