Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
map.php
1<?php
3
6Loc::loadMessages(__FILE__);
7
36class MapTable extends Entity\DataManager
37{
38 public static function getFilePath()
39 {
40 return __FILE__;
41 }
42
43 public static function getTableName()
44 {
45 return 'b_sale_tp_map';
46 }
47
48 public static function getMap()
49 {
50 return array(
51 'ID' => array(
52 'data_type' => 'integer',
53 'primary' => true,
54 'autocomplete' => true,
55 'title' => Loc::getMessage('TRADING_PLATFORM_MAP_ENTITY_ID_FIELD'),
56 ),
57 'ENTITY_ID' => array(
58 'data_type' => 'integer',
59 'required' => true,
60 'title' => Loc::getMessage('TRADING_PLATFORM_MAP_ENTITY_ENTITY_ID_FIELD'),
61 ),
62 'VALUE_EXTERNAL' => array(
63 'data_type' => 'string',
64 'required' => true,
65 'validation' => array(__CLASS__, 'validateValueExternal'),
66 'title' => Loc::getMessage('TRADING_PLATFORM_MAP_ENTITY_VALUE_EXTERNAL_FIELD'),
67 ),
68 'VALUE_INTERNAL' => array(
69 'data_type' => 'string',
70 'required' => true,
71 'validation' => array(__CLASS__, 'validateValueInternal'),
72 'title' => Loc::getMessage('TRADING_PLATFORM_MAP_ENTITY_VALUE_INTERNAL_FIELD'),
73 ),
74 'PARAMS' => array(
75 'data_type' => 'text',
76 'serialized' => true,
77 'title' => Loc::getMessage('TRADING_PLATFORM_MAP_ENTITY_PARAMS_FIELD'),
78 )
79 );
80 }
81
82 public static function validateValueExternal()
83 {
84 return array(
85 new Entity\Validator\Length(null, 255),
86 );
87 }
88 public static function validateValueInternal()
89 {
90 return array(
91 new Entity\Validator\Length(null, 255),
92 );
93 }
94
99 public static function deleteByMapEntityId($mapEntityId)
100 {
101 $con = \Bitrix\Main\Application::getConnection();
102 $sqlHelper = $con->getSqlHelper();
103 $tableName = self::getTableName();
104
105 $strSql =
106 "DELETE FROM ".$tableName." ".
107 "WHERE ENTITY_ID=".$sqlHelper->forSql($mapEntityId);
108
109 $con->queryExecute($strSql);
110 }
111}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static deleteByMapEntityId($mapEntityId)
Definition map.php:99