Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
type.php
1
<?php
2
namespace
Bitrix\Iblock
;
3
4
use
Bitrix\Main
;
5
use
Bitrix\Main\ORM
;
6
use
Bitrix\Main\Localization\Loc
;
7
8
Loc::loadMessages
(__FILE__);
38
class
TypeTable
extends
ORM\Data\DataManager
39
{
45
public
static
function
getTableName
()
46
{
47
return
'b_iblock_type'
;
48
}
49
55
public
static
function
getMap
()
56
{
57
return
array(
58
'ID'
=> array(
59
'data_type'
=>
'string'
,
60
'primary'
=>
true
,
61
'validation'
=> array(__CLASS__,
'validateId'
),
62
'title'
=>
Loc::getMessage
(
'IBLOCK_TYPE_ENTITY_ID_FIELD'
),
63
),
64
'SECTIONS'
=> array(
65
'data_type'
=>
'boolean'
,
66
'values'
=> array(
'N'
,
'Y'
),
67
'title'
=>
Loc::getMessage
(
'IBLOCK_TYPE_ENTITY_SECTIONS_FIELD'
),
68
),
69
'EDIT_FILE_BEFORE'
=> array(
70
'data_type'
=>
'string'
,
71
'validation'
=> array(__CLASS__,
'validateEditFileBefore'
),
72
'title'
=>
Loc::getMessage
(
'IBLOCK_TYPE_ENTITY_EDIT_FILE_BEFORE_FIELD'
),
73
),
74
'EDIT_FILE_AFTER'
=> array(
75
'data_type'
=>
'string'
,
76
'validation'
=> array(__CLASS__,
'validateEditFileAfter'
),
77
'title'
=>
Loc::getMessage
(
'IBLOCK_TYPE_ENTITY_EDIT_FILE_AFTER_FIELD'
),
78
),
79
'IN_RSS'
=> array(
80
'data_type'
=>
'boolean'
,
81
'values'
=> array(
'N'
,
'Y'
),
82
'title'
=>
Loc::getMessage
(
'IBLOCK_TYPE_ENTITY_IN_RSS_FIELD'
),
83
),
84
'SORT'
=> array(
85
'data_type'
=>
'integer'
,
86
'title'
=>
Loc::getMessage
(
'IBLOCK_TYPE_ENTITY_SORT_FIELD'
),
87
),
88
'LANG_MESSAGE'
=> array(
89
'data_type'
=>
'Bitrix\Iblock\TypeLanguage'
,
90
'reference'
=> array(
'=this.ID'
=>
'ref.IBLOCK_TYPE_ID'
),
91
),
92
);
93
}
94
101
public
static
function
validateId
()
102
{
103
return
array(
104
new
ORM\Fields\Validators\LengthValidator(
null
, 50),
105
);
106
}
107
114
public
static
function
validateEditFileBefore
()
115
{
116
return
array(
117
new
ORM\Fields\Validators\LengthValidator(
null
, 255),
118
);
119
}
120
127
public
static
function
validateEditFileAfter
()
128
{
129
return
array(
130
new
ORM\Fields\Validators\LengthValidator(
null
, 255),
131
);
132
}
133
142
public
static
function
onDelete
(ORM\
Event
$event)
143
{
144
//TODO: need refactoring
145
146
$id = $event->getParameter(
"id"
);
147
148
//Delete information blocks
149
$iblockList =
IblockTable::getList
(array(
150
"select"
=> array(
"ID"
),
151
"filter"
=> array(
152
"=IBLOCK_TYPE_ID"
=> $id[
"ID"
],
153
),
154
"order"
=> array(
"ID"
=>
"DESC"
)
155
));
156
while
($iblock = $iblockList->fetch())
157
{
158
$iblockDeleteResult =
IblockTable::delete
($iblock[
"ID"
]);
159
if
(!$iblockDeleteResult->isSuccess())
160
{
161
break
;
162
}
163
}
164
unset($iblock);
165
unset($iblockList);
166
167
//Delete language messages
169
$result =
TypeLanguageTable::deleteByIblockTypeId
($id[
"ID"
]);
170
}
171
172
public
static
function
cleanCache
(): void
173
{
174
parent::cleanCache();
175
176
$application = Main\Application::getInstance();
177
$managedCache = $application->getManagedCache();
178
$managedCache->cleanDir(self::getTableName());
179
unset($managedCache);
180
unset($application);
181
}
182
}
Bitrix\Iblock\TypeLanguageTable\deleteByIblockTypeId
static deleteByIblockTypeId($iblockTypeId)
Definition
typelanguage.php:162
Bitrix\Iblock\TypeTable
Definition
type.php:39
Bitrix\Iblock\TypeTable\onDelete
static onDelete(ORM\Event $event)
Definition
type.php:142
Bitrix\Iblock\TypeTable\getMap
static getMap()
Definition
type.php:55
Bitrix\Iblock\TypeTable\cleanCache
static cleanCache()
Definition
type.php:172
Bitrix\Iblock\TypeTable\validateId
static validateId()
Definition
type.php:101
Bitrix\Iblock\TypeTable\validateEditFileAfter
static validateEditFileAfter()
Definition
type.php:127
Bitrix\Iblock\TypeTable\getTableName
static getTableName()
Definition
type.php:45
Bitrix\Iblock\TypeTable\validateEditFileBefore
static validateEditFileBefore()
Definition
type.php:114
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
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\Data\DataManager\getList
static getList(array $parameters=array())
Definition
datamanager.php:441
Bitrix\Main\ORM\Data\DataManager\delete
static delete($primary)
Definition
datamanager.php:1632
Bitrix\Iblock
Bitrix\Main\ORM
Bitrix\Main
modules
iblock
lib
type.php
Создано системой
1.10.0