Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
extra.php
1
<?php
2
3
namespace
Bitrix\Catalog
;
4
5
use
Bitrix\Main\Localization\Loc
;
6
use
Bitrix\Main\ORM
;
7
use
Bitrix\Catalog\Model
;
8
35
class
ExtraTable
extends
ORM\Data\DataManager
36
{
42
public
static
function
getTableName
()
43
{
44
return
'b_catalog_extra'
;
45
}
46
52
public
static
function
getMap
()
53
{
54
return
[
55
'ID'
=>
new
ORM\Fields\IntegerField
(
56
'ID'
,
57
[
58
'primary'
=>
true
,
59
'autocomplete'
=>
true
,
60
'title'
=>
Loc::getMessage
(
'EXTRA_ENTITY_ID_FIELD'
),
61
]
62
),
63
'NAME'
=>
new
ORM\Fields\StringField
(
64
'NAME'
,
65
[
66
'required'
=>
true
,
67
'validation'
=>
function
()
68
{
69
return
[
70
new
ORM\Fields\Validators\LengthValidator
(
null
, 50),
71
];
72
},
73
'title'
=>
Loc::getMessage
(
'EXTRA_ENTITY_NAME_FIELD'
),
74
]
75
),
76
'PERCENTAGE'
=>
new
ORM\
Fields
\
FloatField
(
77
'PERCENTAGE'
,
78
[
79
'required'
=>
true
,
80
'title'
=>
Loc::getMessage
(
'EXTRA_ENTITY_PERCENTAGE_FIELD'
),
81
]
82
)
83
];
84
}
85
92
public
static
function
onAfterAdd
(ORM\
Event
$event): void
93
{
94
Model\Price::clearSettings();
95
}
96
103
public
static
function
onAfterUpdate
(ORM\
Event
$event): void
104
{
105
Model\Price::clearSettings();
106
}
107
114
public
static
function
onAfterDelete
(ORM\
Event
$event): void
115
{
116
Model\Price::clearSettings();
117
}
118
124
public
static
function
getExtraList
(): array
125
{
126
$result = [];
127
128
$iterator =
self::getList
([
129
'select'
=> [
130
'ID'
,
131
'NAME'
,
132
'PERCENTAGE'
,
133
],
134
'order'
=> [
135
'ID'
=>
'ASC'
,
136
],
137
'cache'
=> [
138
'ttl'
=> 86400,
139
],
140
]);
141
while
($row = $iterator->fetch())
142
{
143
$row[
'ID'
] = (int)$row[
'ID'
];
144
$row[
'PERCENTAGE'
] = (float)$row[
'PERCENTAGE'
];
145
146
$result[$row[
'ID'
]] = $row;
147
}
148
unset($row, $iterator);
149
150
return
$result;
151
}
152
}
Bitrix\Catalog\ExtraTable
Definition
extra.php:36
Bitrix\Catalog\ExtraTable\getMap
static getMap()
Definition
extra.php:52
Bitrix\Catalog\ExtraTable\onAfterDelete
static onAfterDelete(ORM\Event $event)
Definition
extra.php:114
Bitrix\Catalog\ExtraTable\onAfterAdd
static onAfterAdd(ORM\Event $event)
Definition
extra.php:92
Bitrix\Catalog\ExtraTable\onAfterUpdate
static onAfterUpdate(ORM\Event $event)
Definition
extra.php:103
Bitrix\Catalog\ExtraTable\getExtraList
static getExtraList()
Definition
extra.php:124
Bitrix\Catalog\ExtraTable\getTableName
static getTableName()
Definition
extra.php:42
Bitrix\Catalog\Model\Event
Definition
event.php:11
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\Data\DataManager\getList
static getList(array $parameters=array())
Definition
datamanager.php:441
Bitrix\Main\ORM\Fields\FloatField
Definition
floatfield.php:20
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Main\ORM\Fields\Validators\LengthValidator
Definition
lengthvalidator.php:19
Bitrix\Sale\Internals\Fields
Definition
fields.php:6
Bitrix\Catalog\Model
Definition
entity.php:2
Bitrix\Catalog
Bitrix\Main\ORM
modules
catalog
lib
extra.php
Создано системой
1.10.0