Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
resourcetable.php
1<?php
2
4
11
12Loc::loadMessages(__FILE__);
13
57class ResourceTable extends Main\Entity\DataManager
58{
64 public static function getTableName()
65 {
66 return 'b_calendar_resource';
67 }
68
74 public static function getMap()
75 {
76 return [
77 (new IntegerField('ID'))
78 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_ID_FIELD'))
79 ->configurePrimary(true)
80 ->configureAutocomplete(true)
81 ,
82 (new IntegerField('EVENT_ID'))
83 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_EVENT_ID_FIELD'))
84 ,
85 (new StringField('CAL_TYPE',
86 [
87 'validation' => [__CLASS__, 'validateCalType']
88 ]
89 ))
90 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_CAL_TYPE_FIELD'))
91 ,
92 (new IntegerField('RESOURCE_ID'))
93 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_RESOURCE_ID_FIELD'))
94 ->configureRequired(true)
95 ,
96 (new StringField('PARENT_TYPE',
97 [
98 'validation' => [__CLASS__, 'validateParentType']
99 ]
100 ))
101 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_PARENT_TYPE_FIELD'))
102 ,
103 (new IntegerField('PARENT_ID'))
104 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_PARENT_ID_FIELD'))
105 ->configureRequired(true)
106 ,
107 (new IntegerField('UF_ID'))
108 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_UF_ID_FIELD'))
109 ,
110 (new DatetimeField('DATE_FROM_UTC'))
111 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_DATE_FROM_UTC_FIELD'))
112 ,
113 (new DatetimeField('DATE_TO_UTC'))
114 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_DATE_TO_UTC_FIELD'))
115 ,
116 (new DatetimeField('DATE_FROM'))
117 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_DATE_FROM_FIELD'))
118 ,
119 (new DatetimeField('DATE_TO'))
120 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_DATE_TO_FIELD'))
121 ,
122 (new IntegerField('DURATION'))
123 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_DURATION_FIELD'))
124 ,
125 (new StringField('SKIP_TIME',
126 [
127 'validation' => [__CLASS__, 'validateSkipTime']
128 ]
129 ))
130 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_SKIP_TIME_FIELD'))
131 ,
132 (new StringField('TZ_FROM',
133 [
134 'validation' => [__CLASS__, 'validateTzFrom']
135 ]
136 ))
137 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_TZ_FROM_FIELD'))
138 ,
139 (new StringField('TZ_TO',
140 [
141 'validation' => [__CLASS__, 'validateTzTo']
142 ]
143 ))
144 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_TZ_TO_FIELD'))
145 ,
146 (new IntegerField('TZ_OFFSET_FROM'))
147 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_TZ_OFFSET_FROM_FIELD'))
148 ,
149 (new IntegerField('TZ_OFFSET_TO'))
150 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_TZ_OFFSET_TO_FIELD'))
151 ,
152 (new IntegerField('CREATED_BY'))
153 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_CREATED_BY_FIELD'))
154 ->configureRequired(true)
155 ,
156 (new DatetimeField('DATE_CREATE'))
157 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_DATE_CREATE_FIELD'))
158 ,
159 (new DatetimeField('TIMESTAMP_X'))
160 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_TIMESTAMP_X_FIELD'))
161 ,
162 (new StringField('SERVICE_NAME',
163 [
164 'validation' => [__CLASS__, 'validateServiceName']
165 ]
166 ))
167 ->configureTitle(Loc::getMessage('RESOURCE_ENTITY_SERVICE_NAME_FIELD'))
168 ,
169 ];
170 }
171
177 public static function validateCalType(): array
178 {
179 return [
180 new LengthValidator(null, 100),
181 ];
182 }
183
189 public static function validateParentType(): array
190 {
191 return [
192 new LengthValidator(null, 100),
193 ];
194 }
195
201 public static function validateSkipTime(): array
202 {
203 return [
204 new LengthValidator(null, 1),
205 ];
206 }
207
213 public static function validateTzFrom(): array
214 {
215 return [
216 new LengthValidator(null, 50),
217 ];
218 }
219
225 public static function validateTzTo(): array
226 {
227 return [
228 new LengthValidator(null, 50),
229 ];
230 }
231
237 public static function validateServiceName(): array
238 {
239 return [
240 new LengthValidator(null, 200),
241 ];
242 }
243}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29