Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
elementtable.php
1
<?php
2
namespace
Bitrix\Iblock
;
3
4
use
Bitrix\Iblock\ORM\ElementV1Entity
;
5
use
Bitrix\Iblock\ORM\ElementV2Entity
;
6
use
Bitrix\Iblock\ORM\Query
;
7
use
Bitrix\Main
,
8
Bitrix\Main\ORM
,
9
Bitrix\Main\Localization\Loc
;
10
use
Bitrix\Main\ORM\Fields\Relations\ManyToMany
;
11
12
Loc::loadMessages
(__FILE__);
13
78
class
ElementTable
extends
ORM\Data\DataManager
79
{
80
const
TYPE_TEXT
=
'text'
;
81
const
TYPE_HTML
=
'html'
;
82
88
public
static
function
getTableName
()
89
{
90
return
'b_iblock_element'
;
91
}
92
98
public
static
function
getMap
()
99
{
100
return
array(
101
'ID'
=>
new
ORM\Fields\
IntegerField
(
'ID'
, array(
102
'primary'
=>
true
,
103
'autocomplete'
=>
true
,
104
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_ID_FIELD'
),
105
)),
106
'TIMESTAMP_X'
=>
new
ORM\Fields\
DatetimeField
(
'TIMESTAMP_X'
, array(
107
'default_value'
=>
function
()
108
{
109
return
new
Main\Type\DateTime
();
110
},
111
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_TIMESTAMP_X_FIELD'
),
112
)),
113
'MODIFIED_BY'
=>
new
ORM\Fields\IntegerField(
'MODIFIED_BY'
, array(
114
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_MODIFIED_BY_FIELD'
),
115
)),
116
'DATE_CREATE'
=>
new
ORM\Fields\DatetimeField(
'DATE_CREATE'
, array(
117
'default_value'
=>
function
()
118
{
119
return
new
Main\Type\DateTime
();
120
},
121
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_DATE_CREATE_FIELD'
),
122
)),
123
'CREATED_BY'
=>
new
ORM\Fields\IntegerField(
'CREATED_BY'
, array(
124
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_CREATED_BY_FIELD'
),
125
)),
126
'IBLOCK_ID'
=>
new
ORM\Fields\IntegerField(
'IBLOCK_ID'
, array(
127
'required'
=>
true
,
128
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_IBLOCK_ID_FIELD'
),
129
)),
130
'IBLOCK_SECTION_ID'
=>
new
ORM\Fields\IntegerField(
'IBLOCK_SECTION_ID'
, array(
131
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_IBLOCK_SECTION_ID_FIELD'
),
132
)),
133
'ACTIVE'
=>
new
ORM\Fields\BooleanField(
'ACTIVE'
, array(
134
'values'
=> array(
'N'
,
'Y'
),
135
'default_value'
=>
'Y'
,
136
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_ACTIVE_FIELD'
),
137
)),
138
'ACTIVE_FROM'
=>
new
ORM\Fields\DatetimeField(
'ACTIVE_FROM'
, array(
139
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_ACTIVE_FROM_FIELD'
),
140
)),
141
'ACTIVE_TO'
=>
new
ORM\Fields\DatetimeField(
'ACTIVE_TO'
, array(
142
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_ACTIVE_TO_FIELD'
),
143
)),
144
'SORT'
=>
new
ORM\Fields\IntegerField(
'SORT'
, array(
145
'default_value'
=> 500,
146
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_SORT_FIELD'
),
147
)),
148
'NAME'
=>
new
ORM\Fields\StringField(
'NAME'
, array(
149
'required'
=>
true
,
150
'validation'
=> array(__CLASS__,
'validateName'
),
151
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_NAME_FIELD'
),
152
)),
153
'PREVIEW_PICTURE'
=>
new
ORM\Fields\IntegerField(
'PREVIEW_PICTURE'
, array(
154
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_PREVIEW_PICTURE_FIELD'
),
155
)),
156
'PREVIEW_TEXT'
=>
new
ORM\Fields\TextField(
'PREVIEW_TEXT'
, array(
157
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_PREVIEW_TEXT_FIELD'
),
158
)),
159
'PREVIEW_TEXT_TYPE'
=>
new
ORM\Fields\EnumField(
'PREVIEW_TEXT_TYPE'
, array(
160
'values'
=> array(self::TYPE_TEXT, self::TYPE_HTML),
161
'default_value'
=> self::TYPE_TEXT,
162
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_PREVIEW_TEXT_TYPE_FIELD'
),
163
)),
164
'DETAIL_PICTURE'
=>
new
ORM\Fields\IntegerField(
'DETAIL_PICTURE'
, array(
165
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_DETAIL_PICTURE_FIELD'
),
166
)),
167
'DETAIL_TEXT'
=>
new
ORM\Fields\TextField(
'DETAIL_TEXT'
, array(
168
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_DETAIL_TEXT_FIELD'
),
169
)),
170
'DETAIL_TEXT_TYPE'
=>
new
ORM\Fields\EnumField(
'DETAIL_TEXT_TYPE'
, array(
171
'values'
=> array(self::TYPE_TEXT, self::TYPE_HTML),
172
'default_value'
=> self::TYPE_TEXT,
173
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_DETAIL_TEXT_TYPE_FIELD'
),
174
)),
175
'SEARCHABLE_CONTENT'
=>
new
ORM\Fields\TextField(
'SEARCHABLE_CONTENT'
, array(
176
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_SEARCHABLE_CONTENT_FIELD'
),
177
)),
178
'WF_STATUS_ID'
=>
new
ORM\Fields\IntegerField(
'WF_STATUS_ID'
, array(
179
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_WF_STATUS_ID_FIELD'
),
180
)),
181
'WF_PARENT_ELEMENT_ID'
=>
new
ORM\Fields\IntegerField(
'WF_PARENT_ELEMENT_ID'
, array(
182
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_WF_PARENT_ELEMENT_ID_FIELD'
),
183
)),
184
'WF_NEW'
=>
new
ORM\Fields\EnumField(
'WF_NEW'
, array(
185
'values'
=> array(
'N'
,
'Y'
),
186
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_WF_NEW_FIELD'
),
187
)),
188
'WF_LOCKED_BY'
=>
new
ORM\Fields\IntegerField(
'WF_LOCKED_BY'
, array(
189
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_WF_LOCKED_BY_FIELD'
),
190
)),
191
'WF_DATE_LOCK'
=>
new
ORM\Fields\DatetimeField(
'WF_DATE_LOCK'
, array(
192
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_WF_DATE_LOCK_FIELD'
),
193
)),
194
'WF_COMMENTS'
=>
new
ORM\Fields\TextField(
'WF_COMMENTS'
, array(
195
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_WF_COMMENTS_FIELD'
),
196
)),
197
'IN_SECTIONS'
=>
new
ORM\Fields\BooleanField(
'IN_SECTIONS'
, array(
198
'values'
=> array(
'N'
,
'Y'
),
199
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_IN_SECTIONS_FIELD'
),
200
)),
201
'XML_ID'
=>
new
ORM\Fields\StringField(
'XML_ID'
, array(
202
'validation'
=> array(__CLASS__,
'validateXmlId'
),
203
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_XML_ID_FIELD'
),
204
)),
205
'CODE'
=>
new
ORM\Fields\StringField(
'CODE'
, array(
206
'validation'
=> array(__CLASS__,
'validateCode'
),
207
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_CODE_FIELD'
),
208
)),
209
'TAGS'
=>
new
ORM\Fields\StringField(
'TAGS'
, array(
210
'validation'
=> array(__CLASS__,
'validateTags'
),
211
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_TAGS_FIELD'
),
212
)),
213
'TMP_ID'
=>
new
ORM\Fields\StringField(
'TMP_ID'
, array(
214
'validation'
=> array(__CLASS__,
'validateTmpId'
),
215
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_TMP_ID_FIELD'
),
216
)),
217
'SHOW_COUNTER'
=>
new
ORM\Fields\IntegerField(
'SHOW_COUNTER'
, array(
218
'default_value'
=> 0,
219
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_SHOW_COUNTER_FIELD'
),
220
)),
221
'SHOW_COUNTER_START'
=>
new
ORM\Fields\DatetimeField(
'SHOW_COUNTER_START'
, array(
222
'title'
=>
Loc::getMessage
(
'ELEMENT_ENTITY_SHOW_COUNTER_START_FIELD'
),
223
)),
224
'IBLOCK'
=>
new
ORM\Fields\Relations\Reference
(
225
'IBLOCK'
,
226
'\Bitrix\Iblock\Iblock'
,
227
array(
'=this.IBLOCK_ID'
=>
'ref.ID'
),
228
array(
'join_type'
=>
'LEFT'
)
229
),
230
'WF_PARENT_ELEMENT'
=>
new
ORM\Fields\Relations\Reference
(
231
'WF_PARENT_ELEMENT'
,
232
'\Bitrix\Iblock\Element'
,
233
array(
'=this.WF_PARENT_ELEMENT_ID'
=>
'ref.ID'
),
234
array(
'join_type'
=>
'LEFT'
)
235
),
236
'IBLOCK_SECTION'
=>
new
ORM\Fields\Relations\Reference
(
237
'IBLOCK_SECTION'
,
238
'\Bitrix\Iblock\Section'
,
239
array(
'=this.IBLOCK_SECTION_ID'
=>
'ref.ID'
),
240
array(
'join_type'
=>
'LEFT'
)
241
),
242
'MODIFIED_BY_USER'
=>
new
ORM\Fields\Relations\Reference
(
243
'MODIFIED_BY_USER'
,
244
'\Bitrix\Main\User'
,
245
array(
'=this.MODIFIED_BY'
=>
'ref.ID'
),
246
array(
'join_type'
=>
'LEFT'
)
247
),
248
'CREATED_BY_USER'
=>
new
ORM\Fields\Relations\Reference
(
249
'CREATED_BY_USER'
,
250
'\Bitrix\Main\User'
,
251
array(
'=this.CREATED_BY'
=>
'ref.ID'
),
252
array(
'join_type'
=>
'LEFT'
)
253
),
254
'WF_LOCKED_BY_USER'
=>
new
ORM\Fields\Relations\Reference
(
255
'WF_LOCKED_BY_USER'
,
256
'\Bitrix\Main\User'
,
257
array(
'=this.WF_LOCKED_BY'
=>
'ref.ID'
),
258
array(
'join_type'
=>
'LEFT'
)
259
),
260
);
261
}
267
public
static
function
validateName
()
268
{
269
return
array(
270
new
ORM\Fields\Validators\LengthValidator(
null
, 255),
271
);
272
}
273
279
public
static
function
validateXmlId
()
280
{
281
return
array(
282
new
ORM\Fields\Validators\LengthValidator(
null
, 255),
283
);
284
}
290
public
static
function
validateCode
()
291
{
292
return
array(
293
new
ORM\Fields\Validators\LengthValidator(
null
, 255),
294
);
295
}
301
public
static
function
validateTags
()
302
{
303
return
array(
304
new
ORM\Fields\Validators\LengthValidator(
null
, 255),
305
);
306
}
312
public
static
function
validateTmpId
()
313
{
314
return
array(
315
new
ORM\Fields\Validators\LengthValidator(
null
, 40),
316
);
317
}
318
325
public
static
function
add
(array $data)
326
{
327
$result =
new
ORM\Data\AddResult
();
328
$result->addError(
new
ORM\
EntityError
(
329
Loc::getMessage
(
'ELEMENT_ENTITY_MESS_ADD_BLOCKED'
)
330
));
331
return
$result;
332
}
333
341
public
static
function
update
($primary, array $data)
342
{
343
$result =
new
ORM\Data\UpdateResult
();
344
$result->addError(
new
ORM\
EntityError
(
345
Loc::getMessage
(
'ELEMENT_ENTITY_MESS_UPDATE_BLOCKED'
)
346
));
347
return
$result;
348
}
349
356
public
static
function
delete
($primary)
357
{
358
$result =
new
ORM\Data\DeleteResult
();
359
$result->addError(
new
ORM\
EntityError
(
360
Loc::getMessage
(
'ELEMENT_ENTITY_MESS_DELETE_BLOCKED'
)
361
));
362
return
$result;
363
}
364
}
Bitrix\Iblock\ElementTable
Definition
elementtable.php:79
Bitrix\Iblock\ElementTable\getMap
static getMap()
Definition
elementtable.php:98
Bitrix\Iblock\ElementTable\validateXmlId
static validateXmlId()
Definition
elementtable.php:279
Bitrix\Iblock\ElementTable\validateTmpId
static validateTmpId()
Definition
elementtable.php:312
Bitrix\Iblock\ElementTable\add
static add(array $data)
Definition
elementtable.php:325
Bitrix\Iblock\ElementTable\TYPE_HTML
const TYPE_HTML
Definition
elementtable.php:81
Bitrix\Iblock\ElementTable\validateTags
static validateTags()
Definition
elementtable.php:301
Bitrix\Iblock\ElementTable\validateName
static validateName()
Definition
elementtable.php:267
Bitrix\Iblock\ElementTable\TYPE_TEXT
const TYPE_TEXT
Definition
elementtable.php:80
Bitrix\Iblock\ElementTable\update
static update($primary, array $data)
Definition
elementtable.php:341
Bitrix\Iblock\ElementTable\getTableName
static getTableName()
Definition
elementtable.php:88
Bitrix\Iblock\ElementTable\validateCode
static validateCode()
Definition
elementtable.php:290
Bitrix\Iblock\ORM\ElementV1Entity
Definition
elementv1entity.php:17
Bitrix\Iblock\ORM\ElementV2Entity
Definition
elementv2entity.php:16
Bitrix\Iblock\ORM\Query
Definition
query.php:23
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ORM\Data\AddResult
Definition
addresult.php:12
Bitrix\Main\ORM\Data\DataManager
Definition
datamanager.php:33
Bitrix\Main\ORM\Data\DeleteResult
Definition
deleteresult.php:12
Bitrix\Main\ORM\Data\UpdateResult
Definition
updateresult.php:14
Bitrix\Main\ORM\EntityError
Definition
entityerror.php:12
Bitrix\Main\ORM\Fields\DatetimeField
Definition
datetimefield.php:22
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\Relations\ManyToMany
Definition
manytomany.php:26
Bitrix\Main\ORM\Fields\Relations\Reference
Definition
reference.php:26
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Iblock
Bitrix\Main\ORM
Bitrix\Main
modules
iblock
lib
elementtable.php
Создано системой
1.10.0