Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
linkcalendar.php
1
<?php
2
namespace
Bitrix\Im\Model
;
3
4
use
Bitrix\Main\ORM\Data\DataManager
;
5
use Bitrix\Main\ORM\Data\Internal\DeleteByFilterTrait;
6
use
Bitrix\Main\ORM\Fields\DatetimeField
;
7
use
Bitrix\Main\ORM\Fields\IntegerField
;
8
use
Bitrix\Main\ORM\Fields\Relations\Reference
;
9
use
Bitrix\Main\ORM\Fields\StringField
;
10
use
Bitrix\Main\ORM\Fields\Validators\LengthValidator
;
11
use
Bitrix\Main\ORM\Query\Join
;
12
use
Bitrix\Main\ORM\Query\Query
;
13
use
Bitrix\Main\Search\Content
;
14
use
Bitrix\Main\Type\DateTime
;
15
48
class
LinkCalendarTable
extends
DataManager
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::deleteByFilter($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
}
Bitrix\Im\Internals\Query
Definition
query.php:10
Bitrix\Im\Model\LinkCalendarTable
Definition
linkcalendar.php:49
Bitrix\Im\Model\LinkCalendarTable\getMap
static getMap()
Definition
linkcalendar.php:69
Bitrix\Im\Model\LinkCalendarTable\deleteByFilter
static deleteByFilter(array $filter)
Definition
linkcalendar.php:145
Bitrix\Im\Model\LinkCalendarTable\withSearchByTitle
static withSearchByTitle(Query $query, string $searchString)
Definition
linkcalendar.php:151
Bitrix\Im\Model\LinkCalendarTable\validateCalendarTitle
static validateCalendarTitle()
Definition
linkcalendar.php:138
Bitrix\Im\Model\LinkCalendarTable\getTableName
static getTableName()
Definition
linkcalendar.php:59
Bitrix\Main\ORM\Data\DataManager
Definition
datamanager.php:33
Bitrix\Main\ORM\Fields\DatetimeField
Definition
datetimefield.php:22
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\Relations\Reference
Definition
reference.php:26
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Main\ORM\Fields\Validators\LengthValidator
Definition
lengthvalidator.php:19
Bitrix\Main\ORM\Query\Join
Definition
join.php:19
Bitrix\Main\ORM\Query\Query
Definition
query.php:118
Bitrix\Main\ORM\Query\Query\registerRuntimeField
registerRuntimeField($name, $fieldInfo=null)
Definition
query.php:831
Bitrix\Main\Search\Content
Definition
content.php:8
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Im\Model
Definition
alias.php:2
modules
im
lib
model
linkcalendar.php
Создано системой
1.10.0