1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
optiongrouptable.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\Model;
4
5use Bitrix\Main\ArgumentTypeException,
6 Bitrix\Main\ORM\Data\DataManager,
7 Bitrix\Main\ORM\Fields\DatetimeField,
8 Bitrix\Main\ORM\Fields\IntegerField,
9 Bitrix\Main\ORM\Fields\StringField,
10 Bitrix\Main\ORM\Fields\Validators\LengthValidator,
11 Bitrix\Main\SystemException;
12use Bitrix\Main\Entity\Event;
13use Bitrix\Main\ORM\EventResult;
14use Bitrix\Main\Type\DateTime;
15
16
17
48
50{
56 public static function getTableName(): string
57 {
58 return 'b_im_option_group';
59 }
60
67 public static function getMap(): array
68 {
69 return [
70 'ID' => (new IntegerField('ID', [
71 'primary' => true,
72 'autocomplete' => true,
73 ])),
74 'NAME' => (new StringField('NAME', [
75 'validation' => [__CLASS__, 'validateName']
76 ])),
77 'USER_ID' => (new IntegerField('USER_ID', [])),
78 'SORT' => (new IntegerField('SORT', [
79 'required' => true,
80 ])),
81 'DATE_CREATE' => (new DatetimeField('DATE_CREATE', [
82 'required' => true,
83 ])),
84 'CREATE_BY_ID' => (new IntegerField('CREATE_BY_ID', [
85 'required' => true,
86 ])),
87 'DATE_MODIFY' => (new DatetimeField('DATE_MODIFY', [])),
88 'MODIFY_BY_ID' => (new IntegerField('MODIFY_BY_ID', [])),
89 ];
90 }
91
98 public static function validateName(): array
99 {
100 return [
101 new LengthValidator(null, 255),
102 ];
103 }
104
105 public static function onBeforeAdd(Event $event): EventResult
106 {
107 $data = $event->getParameter('fields');
108 $result = new EventResult();
109 if (!isset($data['CREATE_DATE']) || !is_array($data['CREATE_DATE']))
110 {
111 $result->modifyFields(['DATE_CREATE' => new Datetime()]);
112 }
113
114 return $result;
115 }
116
117 public static function onBeforeUpdate(Event $event): EventResult
118 {
119 $data = $event->getParameter('fields');
120 $result = new EventResult();
121 if (!isset($data['MODIFY_DATE']) || !is_array($data['MODIFY_DATE']))
122 {
123 $result->modifyFields(['DATE_MODIFY' => new DateTime()]);
124 }
125
126 return $result;
127 }
128}
static onBeforeAdd(Event $event)
Определения optiongrouptable.php:105
static onBeforeUpdate(Event $event)
Определения optiongrouptable.php:117
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$event
Определения prolog_after.php:141