Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
subscriptiontable.php
1
<?php
2
namespace
Bitrix\Subscribe
;
3
4
use
Bitrix\Main\Localization\Loc
;
5
use
Bitrix\Main\ORM\Data\DataManager
;
6
use
Bitrix\Main\ORM\Fields
;
7
29
class
SubscriptionTable
extends
DataManager
30
{
36
public
static
function
getTableName
()
37
{
38
return
'b_subscription'
;
39
}
40
46
public
static
function
getMap
()
47
{
48
return
[
49
new
Fields\IntegerField(
50
'ID'
,
51
[
52
'primary'
=>
true
,
53
'autocomplete'
=>
true
,
54
'title'
=>
Loc::getMessage
(
'SUBSCRIPTION_ENTITY_ID_FIELD'
),
55
]
56
),
57
new
Fields\DatetimeField(
58
'DATE_INSERT'
,
59
[
60
'required'
=>
true
,
61
'title'
=>
Loc::getMessage
(
'SUBSCRIPTION_ENTITY_DATE_INSERT_FIELD'
),
62
]
63
),
64
new
Fields\DatetimeField(
65
'DATE_UPDATE'
,
66
[
67
'title'
=>
Loc::getMessage
(
'SUBSCRIPTION_ENTITY_DATE_UPDATE_FIELD'
),
68
]
69
),
70
new
Fields\IntegerField(
71
'USER_ID'
,
72
[
73
'title'
=>
Loc::getMessage
(
'SUBSCRIPTION_ENTITY_USER_ID_FIELD'
),
74
]
75
),
76
new
Fields\BooleanField(
77
'ACTIVE'
,
78
[
79
'values'
=> [
'N'
,
'Y'
],
80
'default'
=>
'Y'
,
81
'title'
=>
Loc::getMessage
(
'SUBSCRIPTION_ENTITY_ACTIVE_FIELD'
),
82
]
83
),
84
new
Fields\StringField(
85
'EMAIL'
,
86
[
87
'required'
=>
true
,
88
'validation'
=> [__CLASS__,
'validateEmail'
],
89
'title'
=>
Loc::getMessage
(
'SUBSCRIPTION_ENTITY_EMAIL_FIELD'
),
90
]
91
),
92
new
Fields\StringField(
93
'FORMAT'
,
94
[
95
'default'
=>
'text'
,
96
'validation'
=> [__CLASS__,
'validateFormat'
],
97
'title'
=>
Loc::getMessage
(
'SUBSCRIPTION_ENTITY_FORMAT_FIELD'
),
98
]
99
),
100
new
Fields\StringField(
101
'CONFIRM_CODE'
,
102
[
103
'validation'
=> [__CLASS__,
'validateConfirmCode'
],
104
'title'
=>
Loc::getMessage
(
'SUBSCRIPTION_ENTITY_CONFIRM_CODE_FIELD'
),
105
]
106
),
107
new
Fields\BooleanField(
108
'CONFIRMED'
,
109
[
110
'values'
=> [
'N'
,
'Y'
],
111
'default'
=>
'N'
,
112
'title'
=>
Loc::getMessage
(
'SUBSCRIPTION_ENTITY_CONFIRMED_FIELD'
),
113
]
114
),
115
new
Fields\DatetimeField(
116
'DATE_CONFIRM'
,
117
[
118
'required'
=>
true
,
119
'title'
=>
Loc::getMessage
(
'SUBSCRIPTION_ENTITY_DATE_CONFIRM_FIELD'
),
120
]
121
),
122
new
Fields\Relations\Reference
(
123
'USER'
,
124
'Bitrix\Main\User'
,
125
[
'=this.USER_ID'
=>
'ref.ID'
],
126
[
'join_type'
=>
'LEFT'
]
127
),
128
(
new
Fields\Relations\ManyToMany
(
'RUBRICS'
, \
Bitrix
\Subscribe\RubricTable::class))
129
->configureMediatorTableName(
'b_subscription_rubric'
)
130
->configureLocalPrimary(
'ID'
,
'SUBSCRIPTION_ID'
,
'LIST_RUBRIC_ID'
)
131
->configureRemotePrimary(
'ID'
,
'LIST_RUBRIC_ID'
)
132
,
133
];
134
}
135
141
public
static
function
validateEmail
(): array
142
{
143
return
[
144
new
Fields\Validators\LengthValidator
(
null
, 255),
145
];
146
}
147
153
public
static
function
validateFormat
(): array
154
{
155
return
[
156
new
Fields\Validators\LengthValidator
(
null
, 4),
157
];
158
}
159
165
public
static
function
validateConfirmCode
(): array
166
{
167
return
[
168
new
Fields\Validators\LengthValidator
(
null
, 8),
169
];
170
}
171
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ORM\Data\DataManager
Definition
datamanager.php:33
Bitrix\Main\ORM\Fields\Relations\ManyToMany
Definition
manytomany.php:26
Bitrix\Main\ORM\Fields\Relations\Reference
Definition
reference.php:26
Bitrix\Main\ORM\Fields\Validators\LengthValidator
Definition
lengthvalidator.php:19
Bitrix\Subscribe\SubscriptionTable
Definition
subscriptiontable.php:30
Bitrix\Subscribe\SubscriptionTable\getMap
static getMap()
Definition
subscriptiontable.php:46
Bitrix\Subscribe\SubscriptionTable\validateConfirmCode
static validateConfirmCode()
Definition
subscriptiontable.php:165
Bitrix\Subscribe\SubscriptionTable\validateFormat
static validateFormat()
Definition
subscriptiontable.php:153
Bitrix\Subscribe\SubscriptionTable\validateEmail
static validateEmail()
Definition
subscriptiontable.php:141
Bitrix\Subscribe\SubscriptionTable\getTableName
static getTableName()
Definition
subscriptiontable.php:36
Bitrix\Main\ORM\Fields
Definition
arrayfield.php:9
Bitrix\Subscribe
Definition
rubrictable.php:2
Bitrix
modules
subscribe
lib
subscriptiontable.php
Создано системой
1.10.0