Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
extra.php
1<?php
2
3namespace Bitrix\Catalog;
4
8
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 [
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}
static onAfterDelete(ORM\Event $event)
Definition extra.php:114
static onAfterAdd(ORM\Event $event)
Definition extra.php:92
static onAfterUpdate(ORM\Event $event)
Definition extra.php:103
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static getList(array $parameters=array())