Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
ToolbarItemTable.php
1<?
2
4
6use Bitrix\Main\ORM\Data\Internal\DeleteByFilterTrait;
14
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}