Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
recent.php
1<?php
2namespace Bitrix\Im\Model;
3
4use Bitrix\Im\V2\Common\UpdateByFilterTrait;
6
34class RecentTable extends Main\Entity\DataManager
35{
36 use \Bitrix\Main\ORM\Data\Internal\DeleteByFilterTrait;
37 use UpdateByFilterTrait;
43 public static function getTableName()
44 {
45 return 'b_im_recent';
46 }
47
53 public static function getMap()
54 {
55 return array(
56 'USER_ID' => array(
57 'data_type' => 'integer',
58 'primary' => true,
59 //'title' => Loc::getMessage('RECENT_ENTITY_USER_ID_FIELD'),
60 ),
61 'ITEM_TYPE' => array(
62 'data_type' => 'string',
63 'primary' => true,
64 'validation' => array(__CLASS__, 'validateItemType'),
65 //'title' => Loc::getMessage('RECENT_ENTITY_ITEM_TYPE_FIELD'),
66 ),
67 'ITEM_ID' => array(
68 'data_type' => 'integer',
69 'primary' => true,
70 //'title' => Loc::getMessage('RECENT_ENTITY_ITEM_ID_FIELD'),
71 ),
72 'ITEM_MID' => array(
73 'data_type' => 'integer',
74 'default_value' => 0,
75 //'title' => Loc::getMessage('RECENT_ENTITY_ITEM_MID_FIELD'),
76 ),
77 'ITEM_CID' => array(
78 'data_type' => 'integer',
79 'default_value' => 0,
80 ),
81 'ITEM_RID' => array(
82 'data_type' => 'integer',
83 'default_value' => 0,
84 ),
85 'ITEM_OLID' => array(
86 'data_type' => 'integer',
87 'default_value' => 0,
88 ),
89 'PINNED' => array(
90 'data_type' => 'boolean',
91 'values' => array('N', 'Y'),
92 'default_value' => 'N',
93 ),
94 'UNREAD' => array(
95 'data_type' => 'boolean',
96 'values' => array('N', 'Y'),
97 'default_value' => 'N',
98 ),
99 'DATE_MESSAGE' => array(
100 'data_type' => 'datetime',
101 'required' => true,
102 'default_value' => array(__CLASS__, 'getCurrentDate'),
103 ),
104 'DATE_UPDATE' => array(
105 'data_type' => 'datetime',
106 'required' => true,
107 'default_value' => array(__CLASS__, 'getCurrentDate'),
108 ),
109 'RELATION' => array(
110 'data_type' => 'Bitrix\Im\Model\RelationTable',
111 'reference' => array('=this.ITEM_RID' => 'ref.ID'),
112 'join_type' => 'LEFT',
113 ),
114 'CHAT' => array(
115 'data_type' => 'Bitrix\Im\Model\ChatTable',
116 'reference' => array('=this.ITEM_CID' => 'ref.ID'),
117 'join_type' => 'LEFT',
118 ),
119 'MESSAGE' => array(
120 'data_type' => 'Bitrix\Im\Model\MessageTable',
121 'reference' => array('=this.ITEM_MID' => 'ref.ID'),
122 'join_type' => 'LEFT',
123 ),
124 'MESSAGE_UUID' => array(
125 'data_type' => 'Bitrix\Im\Model\MessageUuidTable',
126 'reference' => array('=this.ITEM_MID' => 'ref.MESSAGE_ID'),
127 'join_type' => 'LEFT',
128 ),
129 'MARKED_ID' => array(
130 'data_type' => 'integer',
131 'default_value' => 0,
132 ),
133 'PIN_SORT' => array(
134 'data_type' => 'integer',
135 ),
136 );
137 }
138
144 public static function validateItemType()
145 {
146 return array(
147 new Main\Entity\Validator\Length(null, 1),
148 );
149 }
150
156 public static function getCurrentDate()
157 {
158 return new \Bitrix\Main\Type\DateTime();
159 }
160}