1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
linkcalendar.php
См. документацию.
1<?php
2namespace Bitrix\Im\Model;
3
4use Bitrix\Main\ORM\Data\DataManager;
5use Bitrix\Main\ORM\Data\Internal\DeleteByFilterTrait;
6use Bitrix\Main\ORM\Fields\DatetimeField;
7use Bitrix\Main\ORM\Fields\IntegerField;
8use Bitrix\Main\ORM\Fields\Relations\Reference;
9use Bitrix\Main\ORM\Fields\StringField;
10use Bitrix\Main\ORM\Fields\Validators\LengthValidator;
11use Bitrix\Main\ORM\Query\Join;
12use Bitrix\Main\ORM\Query\Query;
13use Bitrix\Main\Search\Content;
14use Bitrix\Main\Type\DateTime;
15
47
49{
50 use DeleteByFilterTrait {
51 deleteByFilter as defaultDeleteByFilter;
52 }
53
59 public static function getTableName()
60 {
61 return 'b_im_link_calendar';
62 }
63
69 public static function getMap()
70 {
71 return [
72 'ID' => new IntegerField(
73 'ID',
74 [
75 'primary' => true,
76 'autocomplete' => true,
77 ]
78 ),
79 'MESSAGE_ID' => new IntegerField(
80 'MESSAGE_ID',
81 [
82 'nullable' => true
83 ]
84 ),
85 'CHAT_ID' => new IntegerField(
86 'CHAT_ID',
87 [
88 ]
89 ),
90 'AUTHOR_ID' => new IntegerField(
91 'AUTHOR_ID',
92 [
93 ]
94 ),
95 'DATE_CREATE' => new DatetimeField(
96 'DATE_CREATE',
97 [
98 'required' => true,
99 'default_value' => static function() {
100 return new DateTime();
101 }
102 ]
103 ),
104 'CALENDAR_ID' => new IntegerField(
105 'CALENDAR_ID',
106 [
107 ]
108 ),
109 'CALENDAR_TITLE' => new StringField(
110 'CALENDAR_TITLE',
111 [
112 'validation' => [__CLASS__, 'validateCalendarTitle'],
113 ]
114 ),
115 'CALENDAR_DATE_FROM' => new DatetimeField(
116 'CALENDAR_DATE_FROM',
117 [
118 ]
119 ),
120 'CALENDAR_DATE_TO' => new DatetimeField(
121 'CALENDAR_DATE_TO',
122 [
123 ]
124 ),
125 'INDEX' => (new Reference(
126 'INDEX',
127 LinkCalendarIndexTable::class,
128 Join::on('this.ID', 'ref.ID')
129 ))->configureJoinType(Join::TYPE_INNER),
130 ];
131 }
132
138 public static function validateCalendarTitle(): array
139 {
140 return [
141 new LengthValidator(null, 255),
142 ];
143 }
144
145 public static function deleteByFilter(array $filter)
146 {
147 LinkCalendarIndexTable::deleteByParentFilter($filter);
148 static::defaultDeleteByFilter($filter);
149 }
150
151 public static function withSearchByTitle(Query $query, string $searchString): void
152 {
153 $preparedSearchString = LinkCalendarIndexTable::prepareSearchString($searchString);
154 if (Content::canUseFulltextSearch($preparedSearchString))
155 {
156 $query->registerRuntimeField(
157 (new Reference(
158 'INDEX',
159 LinkCalendarIndexTable::class,
160 Join::on('this.ID', 'ref.ID')
161 ))->configureJoinType(Join::TYPE_INNER)
162 );
163
164 $query->whereMatch('INDEX.SEARCH_CONTENT', $preparedSearchString);
165 }
166 }
167}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$query
Определения get_search.php:11
$filter
Определения iblock_catalog_list.php:54
Определения chain.php:3