Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
parameters.php
1<?php
3
4use Bitrix\Main\Entity\DataManager;
5
23 extends DataManager
24{
25 const SEF_MODE = 'Y';
26 const NOT_SEF_MODE = 'N';
27
28 public static function getTableName()
29 {
30 return 'b_component_params';
31 }
32
33 public static function getMap()
34 {
35 return array(
36 'ID' => array(
37 'data_type' => 'integer',
38 'primary' => true,
39 'autocomplete' => true,
40 ),
41 'SITE_ID' => array(
42 'data_type' => 'string',
43 'required' => true,
44 ),
45 'COMPONENT_NAME' => array(
46 'data_type' => 'string',
47 'required' => true,
48 ),
49 'TEMPLATE_NAME' => array(
50 'data_type' => 'string',
51 ),
52 'REAL_PATH' => array(
53 'data_type' => 'string',
54 'required' => true,
55 ),
56 'SEF_MODE' => array(
57 'data_type' => 'boolean',
58 'values' => array(self::NOT_SEF_MODE, self::SEF_MODE),
59 ),
60 'SEF_FOLDER' => array(
61 'data_type' => 'string',
62 ),
63 'START_CHAR' => array(
64 'data_type' => 'integer',
65 'required' => true,
66 ),
67 'END_CHAR' => array(
68 'data_type' => 'integer',
69 'required' => true,
70 ),
71 'PARAMETERS' => array(
72 'data_type' => 'text',
73 ),
74 );
75 }
76
77 public static function deleteBySiteId($siteId)
78 {
79 if (empty($siteId))
80 throw new \Bitrix\Main\ArgumentNullException("siteId");
81
82 $result = new \Bitrix\Main\Entity\DeleteResult();
83
84 // event PRE
85
86 // delete
87 $connection = \Bitrix\Main\Application::getConnection();
88 $helper = $connection->getSqlHelper();
89
90 $tableName = static::getEntity()->getDBTableName();
91
92 $sql = "DELETE FROM ".$tableName." WHERE SITE_ID = '".$helper->forSql($siteId)."'";
93 $connection->queryExecute($sql);
94
95 // event POST
96 return $result;
97 }
98
99 public static function deleteByFilter($filter)
100 {
101 if (empty($filter))
102 throw new \Bitrix\Main\ArgumentNullException("filter");
103
104 $result = new \Bitrix\Main\Entity\DeleteResult();
105
106 $dbResult = static::getList(
107 array(
108 "select" => array("ID"),
109 "filter" => $filter,
110 )
111 );
112 while ($ar = $dbResult->fetch())
113 static::delete($ar["ID"]);
114
115 return $result;
116 }
117}