Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
discountmodule.php
1
<?php
2
namespace
Bitrix\Catalog
;
3
4
use
Bitrix\Main
,
5
Bitrix\Main\Localization\Loc
;
6
Loc::loadMessages
(__FILE__);
7
34
class
DiscountModuleTable
extends
Main\Entity\DataManager
35
{
41
public
static
function
getTableName
()
42
{
43
return
'b_catalog_discount_module'
;
44
}
45
51
public
static
function
getMap
()
52
{
53
return
array(
54
'ID'
=>
new
Main\
Entity
\
IntegerField
(
'ID'
, array(
55
'primary'
=>
true
,
56
'autocomplete'
=>
true
,
57
'title'
=>
Loc::getMessage
(
'DISCOUNT_MODULE_ENTITY_ID_FIELD'
)
58
)),
59
'DISCOUNT_ID'
=>
new
Main\
Entity
\
IntegerField
(
'DISCOUNT_ID'
, array(
60
'required'
=>
true
,
61
'title'
=>
Loc::getMessage
(
'DISCOUNT_MODULE_ENTITY_DISCOUNT_ID_FIELD'
)
62
)),
63
'MODULE_ID'
=>
new
Main\
Entity
\
StringField
(
'MODULE_ID'
, array(
64
'required'
=>
true
,
65
'validation'
=> array(__CLASS__,
'validateModuleId'
),
66
'title'
=>
Loc::getMessage
(
'DISCOUNT_MODULE_ENTITY_MODULE_ID_FIELD'
)
67
))
68
);
69
}
75
public
static
function
validateModuleId
()
76
{
77
return
array(
78
new
Main\
Entity
\Validator\Length(
null
, 50),
79
);
80
}
81
88
public
static
function
deleteByDiscount
($discount)
89
{
90
$discount = (int)$discount;
91
if
($discount <= 0)
92
return
;
93
$conn = Main\Application::getConnection();
94
$helper = $conn->getSqlHelper();
95
$conn->queryExecute(
96
'delete from '
.$helper->quote(self::getTableName()).
' where '
.$helper->quote(
'DISCOUNT_ID'
).
' = '
.$discount
97
);
98
unset($helper, $conn);
99
}
100
}
Bitrix\Catalog\DiscountModuleTable
Definition
discountmodule.php:35
Bitrix\Catalog\DiscountModuleTable\getMap
static getMap()
Definition
discountmodule.php:51
Bitrix\Catalog\DiscountModuleTable\deleteByDiscount
static deleteByDiscount($discount)
Definition
discountmodule.php:88
Bitrix\Catalog\DiscountModuleTable\validateModuleId
static validateModuleId()
Definition
discountmodule.php:75
Bitrix\Catalog\DiscountModuleTable\getTableName
static getTableName()
Definition
discountmodule.php:41
Bitrix\Catalog\Model\Entity
Definition
entity.php:12
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\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Catalog
Bitrix\Main
modules
catalog
lib
discountmodule.php
Создано системой
1.10.0