Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
ToolbarItemTable.php
1
<?
2
3
namespace
Bitrix\Main\SidePanel
;
4
5
use
Bitrix\Main\ORM\Data
;
6
use Bitrix\Main\ORM\Data\Internal\DeleteByFilterTrait;
7
use
Bitrix\Main\ORM\Fields\StringField
;
8
use
Bitrix\Main\ORM\Fields\IntegerField
;
9
use
Bitrix\Main\ORM\Fields\DatetimeField
;
10
use
Bitrix\Main\ORM\Fields\Validators\ForeignValidator
;
11
use
Bitrix\Main\ORM\Fields\Validators\LengthValidator
;
12
use
Bitrix\Main\Text\Emoji
;
13
use
Bitrix\Main\Type\DateTime
;
14
31
class
ToolbarItemTable
extends
Data\DataManager
32
{
33
use DeleteByFilterTrait;
34
38
public
static
function
getTableName
()
39
{
40
return
'b_sidepanel_toolbar_item'
;
41
}
42
46
public
static
function
getMap
()
47
{
48
return
[
49
(
new
IntegerField
(
'ID'
))
50
->configurePrimary()
51
->configureAutocomplete()
52
,
53
(
new
IntegerField
(
'TOOLBAR_ID'
))
54
->configureRequired()
55
->addValidator(
new
ForeignValidator
(
ToolbarTable::getEntity
()->getField(
'ID'
)))
56
,
57
(
new
StringField
(
'URL'
))
58
->configureRequired()
59
->configureSize(2000)
60
->configureFormat(
'~^/~'
)
61
->addValidator(
new
LengthValidator
(1, 2000))
62
,
63
(
new
StringField
(
'TITLE'
))
64
->configureRequired()
65
->configureSize(255)
66
->addValidator(
new
LengthValidator
(1, 255))
67
->addSaveDataModifier([Emoji::class,
'encode'
])
68
->addFetchDataModifier([Emoji::class,
'decode'
])
69
,
70
(
new
StringField
(
'ENTITY_TYPE'
))
71
->configureRequired()
72
->configureSize(50)
73
->configureFormat(
'/^[a-zA-Z0-9_:-]+$/'
)
74
->addValidator(
new
LengthValidator
(2, 50))
75
->addSaveDataModifier(
function
($value) {
76
return
mb_strtolower($value);
77
})
78
,
79
(
new
StringField
(
'ENTITY_ID'
))
80
->configureRequired()
81
->configureSize(50)
82
->configureFormat(
'/^[a-zA-Z0-9_:-]+$/'
)
83
->addValidator(
new
LengthValidator
(1, 50))
84
->addSaveDataModifier(
function
($value) {
85
return
mb_strtolower($value);
86
})
87
,
88
(
new
DatetimeField
(
'CREATED_DATE'
))
89
->configureDefaultValue(
static
function
() {
90
return
new
DateTime
();
91
})
92
,
93
(
new
DatetimeField
(
'LAST_USE_DATE'
))
94
->configureDefaultValue(
static
function
() {
95
return
new
DateTime
();
96
})
97
,
98
];
99
}
100
}
Bitrix\Main\ORM\Data\DataManager
Definition
datamanager.php:33
Bitrix\Main\ORM\Data\DataManager\getEntity
static getEntity()
Definition
datamanager.php:78
Bitrix\Main\ORM\Fields\DatetimeField
Definition
datetimefield.php:22
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Main\ORM\Fields\Validators\ForeignValidator
Definition
foreignvalidator.php:24
Bitrix\Main\ORM\Fields\Validators\LengthValidator
Definition
lengthvalidator.php:19
Bitrix\Main\SidePanel\ToolbarItemTable
Definition
ToolbarItemTable.php:32
Bitrix\Main\SidePanel\ToolbarItemTable\getMap
static getMap()
Definition
ToolbarItemTable.php:46
Bitrix\Main\SidePanel\ToolbarItemTable\getTableName
static getTableName()
Definition
ToolbarItemTable.php:38
Bitrix\Main\Text\Emoji
Definition
emoji.php:10
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Main\ORM\Data
Definition
addresult.php:9
Bitrix\Main\SidePanel
Definition
Toolbar.php:2
modules
main
lib
SidePanel
ToolbarItemTable.php
Создано системой
1.10.0