Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
discountmodule.php
1<?php
2namespace Bitrix\Catalog;
3
6Loc::loadMessages(__FILE__);
7
34class 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}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29